39 #ifndef CXXUTILS_CONCEPTS_H
40 #define CXXUTILS_CONCEPTS_H
43 #include <type_traits>
49 #define HAVE_CONCEPTS 1
52 #define ATH_REQUIRES(...) requires __VA_ARGS__
54 #define ATH_MEMBER_REQUIRES(CONDITION, RETTYPE) \
55 template <bool = true> \
56 requires (CONDITION) \
59 #define ATH_MEMBER_REQUIRES_DEF(CONDITION, RETTYPE) \
61 requires (CONDITION) \
72 template <
class HASHER,
class T>
74 std::destructible<HASHER> &&
75 std::copy_constructible<HASHER> &&
76 requires (
const HASHER&
h, T
x)
78 {
h(
x) } -> std::same_as<std::size_t>;
83 template <
class PRED,
class ARG1,
class ARG2=ARG1>
84 concept IsBinaryPredicate =
85 std::copy_constructible<PRED> &&
86 std::predicate<PRED, ARG1, ARG2>;
89 template <
class CONTAINER>
90 concept IsContiguousContainer =
91 requires (CONTAINER&
c)
93 requires std::contiguous_iterator<decltype(
c.begin())>;
97 template <
class ITERATOR,
class VAL>
98 concept InputValIterator =
99 std::input_iterator<ITERATOR> &&
100 std::convertible_to<std::iter_value_t<ITERATOR>, VAL>;
108 #define HAVE_CONCEPTS 0
110 #define ATH_REQUIRES(...)
112 #define ATH_MEMBER_REQUIRES(CONDITION, RETTYPE) \
113 template <bool Enable = true> \
114 std::enable_if_t<Enable && (CONDITION), RETTYPE>
116 #define ATH_MEMBER_REQUIRES_DEF(CONDITION, RETTYPE) \
117 template <bool Enable> \
118 std::enable_if_t<Enable && (CONDITION), RETTYPE>
123 #endif // not CXXUTILS_CONCEPTS_H