11 #include <type_traits>
16 template<
class... Ts>
struct overloaded : Ts... {
using Ts::operator()...; };
21 template <
bool If,
typename Then,
typename Else>
22 using Conditional =
typename std::conditional<If, Then, Else>::type;
23 template <
bool B,
typename...>
26 template <
bool B,
typename... T>
34 template <
typename... T>
36 template <
typename Head,
typename... Tail>
37 struct any<Head, Tail...> :
Conditional<Head::value, Bool<true>, any<Tail...>> {};
40 template <
typename... T>
42 template <
typename Head,
typename... Tail>
43 struct all<Head, Tail...> :
Conditional<Head::value, all<Tail...>, Bool<false>> {};
56 template <
typename Condition>
57 using EnableIf =
typename std::enable_if<Condition::value, dtl::enabled>::type;
58 template <
typename Condition>
59 using DisableIf =
typename std::enable_if<!Condition::value, dtl::enabled>::type;
60 template <
bool Condition>
61 using EnableIfBool =
typename std::enable_if<Condition, dtl::enabled>::type;
63 template <
typename... Condition>
67 template <
bool Condition>
68 using EnableIfBool =
typename std::enable_if<Condition, dtl::enabled>::type;
71 template<
typename>
struct Void {
using type = void; };
74 #define has_method_struct(methodname) \
75 __if_exists(T::methodname) { \
76 template<typename T, typename SFINAE = void> \
77 struct has_##methodname : std::true_type {}; \
79 __if_not_exists(T::methodname) { \
80 template<typename T, typename SFINAE = void> \
81 struct has_##methodname : std::false_type {}; \
84 #define has_method_struct(methodname) \
85 template<typename T, typename SFINAE = void> \
86 struct has_##methodname : std::false_type {}; \
87 template<typename T> \
88 struct has_##methodname<T, typename Void<decltype( std::declval<T&>().methodname() )>::type> : std::true_type {};
91 #define has_function_overload(methodname) \
92 template<typename T, typename SFINAE = void> \
93 struct has_##methodname: std::false_type {}; \
94 template<typename T> \
95 struct has_##methodname<T, typename Void<decltype( methodname(std::declval<T&>()) )>::type> : std::true_type {};
105 template <
template <
typename...>
class Template,
typename T >
107 template <
template <
typename...>
class Template,
typename... Args >
#define has_function_overload(methodname)
carl is the main namespace for the library.
bool is_positive(const cln::cl_I &n)
typename std::enable_if< Not< any< Condition... > >::value, dtl::enabled >::type DisableIf
typename std::enable_if< all< Condition... >::value, dtl::enabled >::type EnableIf
constexpr bool dependent_false_v
bool is_zero(const Interval< Number > &i)
Check if this interval is a point-interval containing 0.
Bool<!T::value > Not
Meta-logical negation.
has_method_struct(normalize) has_method_struct(is_negative) has_method_struct(is_positive) has_function_overload(is_one) has_function_overload(is_zero) template< template< typename... > class Template
bool is_negative(const cln::cl_I &n)
typename dependent_bool_type< B, T... >::type Bool
overloaded(Ts...) -> overloaded< Ts... >
typename std::conditional< If, Then, Else >::type Conditional
bool is_one(const Interval< Number > &i)
Check if this interval is a point-interval containing 1.
typename std::enable_if< Condition, dtl::enabled >::type EnableIfBool
Meta-logical disjunction.
Meta-logical conjunction.