summaryrefslogtreecommitdiff
path: root/json4cpp/include/nlohmann/detail/meta/logic.hpp
blob: cb50a5d19aa13a786cc00fec4d12a9ac463b8c70 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#pragma once

#include <nlohmann/detail/macro_scope.hpp>

NLOHMANN_JSON_NAMESPACE_BEGIN
namespace detail
{
#ifdef JSON_HAS_CPP_17

template<bool... Booleans>
struct cxpr_or_impl : std::integral_constant < bool, (Booleans || ...) > {};

template<bool... Booleans>
struct cxpr_and_impl : std::integral_constant < bool, (Booleans &&...) > {};

#else

template<bool... Booleans>
struct cxpr_or_impl : std::false_type {};

template<bool... Booleans>
struct cxpr_or_impl<true, Booleans...> : std::true_type {};

template<bool... Booleans>
struct cxpr_or_impl<false, Booleans...> : cxpr_or_impl<Booleans...> {};

template<bool... Booleans>
struct cxpr_and_impl : std::true_type {};

template<bool... Booleans>
struct cxpr_and_impl<true, Booleans...> : cxpr_and_impl<Booleans...> {};

template<bool... Booleans>
struct cxpr_and_impl<false, Booleans...> : std::false_type {};

#endif

template<class Boolean>
struct cxpr_not : std::integral_constant < bool, !Boolean::value > {};

template<class... Booleans>
struct cxpr_or : cxpr_or_impl<Booleans::value...> {};

template<bool... Booleans>
struct cxpr_or_c : cxpr_or_impl<Booleans...> {};

template<class... Booleans>
struct cxpr_and : cxpr_and_impl<Booleans::value...> {};

template<bool... Booleans>
struct cxpr_and_c : cxpr_and_impl<Booleans...> {};

}  // namespace detail
NLOHMANN_JSON_NAMESPACE_END