6#ifndef SL_UTILITY_CONCEPTS_STL_EXTENSIONS_HPP
7#define SL_UTILITY_CONCEPTS_STL_EXTENSIONS_HPP
52 concept decayed = std::same_as<std::decay_t<T>, T>;
60 concept unqualified = std::same_as<std::remove_cvref_t<T>, T>;
68 template <
class TLhs,
class TRhs>
77 template <
class TSource,
class TTarget>
78 concept initializes = std::constructible_from<TTarget, TSource>;
86 template <
class TSource,
class TTarget>
98 { t == t } -> std::convertible_to<bool>;
99 { t != t } -> std::convertible_to<bool>;
110 &&
requires(
const std::remove_cvref_t<T>& t)
112 { t == t }
noexcept -> std::convertible_to<bool>;
113 { t != t }
noexcept -> std::convertible_to<bool>;
123 template <
class T1,
class T2>
126 { t1 == t2 } -> std::convertible_to<bool>;
127 { t1 != t2 } -> std::convertible_to<bool>;
128 { t2 == t1 } -> std::convertible_to<bool>;
129 { t2 != t1 } -> std::convertible_to<bool>;
139 template <
class T1,
class T2>
142 { t1 == t2 }
noexcept -> std::convertible_to<bool>;
143 { t1 != t2 }
noexcept -> std::convertible_to<bool>;
144 { t2 == t1 }
noexcept -> std::convertible_to<bool>;
145 { t2 != t1 }
noexcept -> std::convertible_to<bool>;
163 template <
class TFrom,
class TTo>
166 static_cast<TTo
>(std::declval<TFrom>());
176 template <
class TFrom,
class TTo>
179 {
static_cast<TTo
>(std::declval<TFrom>()) }
noexcept;
187namespace sl::concepts::detail
189 template <
class Category,
class MinimumCategory>
190 concept compares_as = comparison_category<Category>
191 && comparison_category<MinimumCategory>
192 && std::same_as<std::common_comparison_category_t<Category, MinimumCategory>, MinimumCategory>;
209 template <
class T,
class MinimumCategory = std::partial_ordering>
212 &&
requires(
const std::remove_reference_t<T>& t)
214 { t <=> t } -> detail::compares_as<MinimumCategory>;
225 template <
class T,
class MinimumCategory = std::partial_ordering>
228 &&
requires(
const std::remove_reference_t<T>& t)
230 { t <=> t }
noexcept -> detail::compares_as<MinimumCategory>;
241 template <
class T1,
class T2,
class MinimumCategory = std::partial_ordering>
245 &&
requires(
const std::remove_reference_t<T1>& t1,
const std::remove_reference_t<T2>& t2)
247 { t1 <=> t2 } -> detail::compares_as<MinimumCategory>;
248 { t2 <=> t1 } -> detail::compares_as<MinimumCategory>;
259 template <
class T1,
class T2,
class MinimumCategory = std::partial_ordering>
263 &&
requires(
const std::remove_reference_t<T1>& t1,
const std::remove_reference_t<T2>& t2)
265 { t1 <=> t2 }
noexcept -> detail::compares_as<MinimumCategory>;
266 { t2 <=> t1 }
noexcept -> detail::compares_as<MinimumCategory>;
Checks whether the target type is assignable from the source type.
Definition: stl_extensions.hpp:87
Checks whether the given type denotes a common stl comparison category.
Definition: stl_extensions.hpp:154
Checks whether the T denotes a decayed type.
Definition: stl_extensions.hpp:52
Checks whether a type is explicit convertible to another.
Definition: stl_extensions.hpp:164
Checks whether the target type is constructible from the source type.
Definition: stl_extensions.hpp:78
Checks whether the left-hand-side type is unequal to the right-hand-side type.
Definition: stl_extensions.hpp:69
Checks whether a type is explicit convertible to another and does not throw.
Definition: stl_extensions.hpp:177
Checks whether a symmetrical set of operators == and != to compare both types with each other exists ...
Definition: stl_extensions.hpp:140
Checks whether the given type is comparable via operator == and != and has noexcept specifier.
Definition: stl_extensions.hpp:109
Checks whether a symmetrical set of operator <=> to compare both types with each other with noexcept ...
Definition: stl_extensions.hpp:260
Checks whether the given type is comparable <=> with the minimal comparison category and noexcept spe...
Definition: stl_extensions.hpp:226
Checks whether the T denotes a (possibly cv-qualified) pointer type.
Definition: stl_extensions.hpp:35
Checks whether the T denotes a reference type.
Definition: stl_extensions.hpp:44
Checks whether the T denotes an unqualified type.
Definition: stl_extensions.hpp:60
Checks whether a symmetrical set of operators == and != to compare both types with each other exists.
Definition: stl_extensions.hpp:124
Checks whether the given type is comparable via operator == and !=.
Definition: stl_extensions.hpp:96
Checks whether a symmetrical set of operator <=> to compare both types with each other exists.
Definition: stl_extensions.hpp:242
Checks whether the given type is comparable <=> with the minimal comparison category....
Definition: stl_extensions.hpp:210
Definition: operators.hpp:15