Nix 2.36.0
Nix, the purely functional package manager; unstable internal interfaces
Loading...
Searching...
No Matches
json-non-null.hh
Go to the documentation of this file.
1#pragma once
3
4#include <string>
5#include <vector>
6#include <set>
7#include <map>
8#include <list>
9
10namespace nix {
11
17template<typename T>
18struct json_avoids_null;
19
23template<typename T>
24struct json_avoids_null : std::bool_constant<std::is_integral<T>::value>
25{};
26
27template<>
28struct json_avoids_null<std::nullptr_t> : std::false_type
29{};
30
31template<>
32struct json_avoids_null<bool> : std::true_type
33{};
34
35template<>
36struct json_avoids_null<std::string> : std::true_type
37{};
38
39template<typename T>
40struct json_avoids_null<std::vector<T>> : std::true_type
41{};
42
43template<typename T>
44struct json_avoids_null<std::list<T>> : std::true_type
45{};
46
47template<typename T, typename Compare>
48struct json_avoids_null<std::set<T, Compare>> : std::true_type
49{};
50
51template<typename K, typename V, typename Compare>
52struct json_avoids_null<std::map<K, V, Compare>> : std::true_type
53{};
54
55} // namespace nix