13namespace circus::traits {
17template <
typename Ts,
typename... Us>
19 constexpr static bool value = (std::is_same_v<Ts, Us> || ...);
24template <
typename TypeComparablePolicy,
typename... Ts>
30template <
typename Curr,
typename... Others>
32[[nodiscard]]
constexpr static bool any_of(
const Curr &c,
const Others &&...o)
noexcept {
33 return ((c == o) || ...);
38template <
typename Curr,
typename... Others>
40[[nodiscard]]
constexpr static bool none_of(
const Curr &c, Others &&...o)
noexcept {
41 return !(any_of(c, std::forward<Others>(o)...));
49 t.serialize(std::declval<std::ostream &>())
56concept OutStream = std::is_convertible_v<T, std::ostream &>;
62 requires(std::ostream &os, T value) {
72concept InStream = std::is_convertible_v<T, std::istream &>;
85template <
typename T,
typename =
void>
91 decltype(std::declval<T>().first),
92 decltype(std::declval<T>().second)>> : std::true_type {
93 using first_type =
decltype(std::declval<T>().first);
94 using second_type =
decltype(std::declval<T>().second);
105concept StringLike = std::is_convertible_v<T, std::string_view>;
116 using value_type = T;
119template <
typename T,
typename A>
121 using value_type = T;
127concept Flaggable = std::is_enum_v<T> && (std::is_same_v<std::underlying_type_t<T>, std::uint64_t> || std::is_same_v<std::underlying_type_t<T>, std::uint32_t>);
141 requires std::regular<T>;
142 requires std::swappable<T>;
143 requires std::same_as<typename T::reference, typename T::value_type &>;
144 requires std::same_as<typename T::const_reference, const typename T::value_type &>;
145 requires std::forward_iterator<typename T::iterator>;
146 requires std::forward_iterator<typename T::const_iterator>;
147 requires std::signed_integral<typename T::difference_type>;
148 requires std::same_as<typename T::difference_type, typename std::iterator_traits<typename T::iterator>::difference_type>;
149 requires std::same_as<typename T::difference_type, typename std::iterator_traits<typename T::const_iterator>::difference_type>;
150 { a.begin() } -> std::same_as<typename T::iterator>;
151 { a.end() } -> std::same_as<typename T::iterator>;
152 { b.begin() } -> std::same_as<typename T::const_iterator>;
153 { b.end() } -> std::same_as<typename T::const_iterator>;
154 { a.cbegin() } -> std::same_as<typename T::const_iterator>;
155 { a.cend() } -> std::same_as<typename T::const_iterator>;
156 { a.size() } -> std::same_as<typename T::size_type>;
157 { a.max_size() } -> std::same_as<typename T::size_type>;
158 { a.empty() } -> std::convertible_to<bool>;
Concept that checks if all types match a given type.
Definition circus_traits.hpp:25
Concept for containers that satisfy a wide set of STL-like requirements. Includes regularity,...
Definition circus_traits.hpp:140
Concept for enum types that are eligible for flagging (i.e., bitmask ops).
Definition circus_traits.hpp:127
Concept that checks if a type can be used as an input stream.
Definition circus_traits.hpp:72
Concept for values that can be extracted from an std::istream using >>.
Definition circus_traits.hpp:77
Concept that checks whether a type has a .serialize(std::ostream&) method.
Definition circus_traits.hpp:47
Concept that checks if a type can be used as an output stream.
Definition circus_traits.hpp:56
Concept for values that can be streamed using << to an std::ostream.
Definition circus_traits.hpp:61
Concept for types that behave like key-value pairs.
Definition circus_traits.hpp:100
Concept for types that are serializable via either literal streaming or custom serialize.
Definition circus_traits.hpp:110
Concept for std::vector-like containers whose elements can be streamed.
Definition circus_traits.hpp:132
Concept for types that can be converted to a string-like view.
Definition circus_traits.hpp:105
Checks if a type Ts exists among a variadic list of types Us.
Definition circus_traits.hpp:18
Trait to determine if a type is a std::vector.
Definition circus_traits.hpp:115
Trait to determine if a type is a pair-like structure (has .first and .second).
Definition circus_traits.hpp:86