ORIGINAL
Loading...
Searching...
No Matches
types.h
Go to the documentation of this file.
1#ifndef TYPES_H
2#define TYPES_H
3
4#include "type_traits"
5#include <concepts>
6
15
16namespace original {
17
30template<typename... ARGS>
31concept NotNull = sizeof...(ARGS) > 0;
32
44template <typename TYPE>
45concept Comparable = requires(const TYPE& t1, const TYPE& t2) {
46 { t1 == t2 } -> std::same_as<bool>;
47 { t1 != t2 } -> std::same_as<bool>;
48 { t1 < t2 } -> std::same_as<bool>;
49 { t1 <= t2 } -> std::same_as<bool>;
50 { t1 > t2 } -> std::same_as<bool>;
51 { t1 >= t2 } -> std::same_as<bool>;
52};
53
68template <typename Callback, typename ReturnType, typename... Args>
69concept CallbackOf = requires(Callback callback, Args&&... args){
70 { callback(std::forward<Args>(args)...) } -> std::same_as<ReturnType>;
71};
72
91template <typename Callback, typename TYPE>
92concept Compare =
94
112template <typename Callback, typename TYPE>
114
132template <typename Callback, typename TYPE>
134
152template <typename Base, typename Derive>
153concept SuperOf = std::is_base_of_v<Base, Derive> || std::is_same_v<Base, Derive>;
154
172template <typename Base, typename Derive>
173concept ExtendsOf = std::derived_from<Derive, Base> || std::is_same_v<Base, Derive>;
174
175} // namespace original
176
177#endif // TYPES_H
Validates callback signature compatibility.
Definition types.h:69
Requires type to support all comparison operators.
Definition types.h:45
Combines Comparable and CallbackOf for comparison callbacks.
Definition types.h:92
Constraint for predicate callbacks.
Definition types.h:113
Checks derivation or type identity.
Definition types.h:173
Ensures the parameter pack is not empty.
Definition types.h:31
Constraint for mutating operations.
Definition types.h:133
Checks inheritance or type equality.
Definition types.h:153
Main namespace for the project Original.
Definition algorithms.h:21