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
14
15namespace original {
16
28template <typename TYPE>
29concept Comparable = requires(const TYPE& t1, const TYPE& t2) {
30 { t1 == t2 } -> std::same_as<bool>;
31 { t1 != t2 } -> std::same_as<bool>;
32 { t1 < t2 } -> std::same_as<bool>;
33 { t1 <= t2 } -> std::same_as<bool>;
34 { t1 > t2 } -> std::same_as<bool>;
35 { t1 >= t2 } -> std::same_as<bool>;
36};
37
52template <typename Callback, typename ReturnType, typename... Args>
53concept CallbackOf = requires(Callback callback, Args&&... args){
54 { callback(std::forward<Args>(args)...) } -> std::same_as<ReturnType>;
55};
56
75template <typename Callback, typename TYPE>
76concept Compare =
78
96template <typename Callback, typename TYPE>
98
116template <typename Callback, typename TYPE>
118
136template <typename Base, typename Derive>
137concept SuperOf = std::is_base_of_v<Base, Derive> || std::is_same_v<Base, Derive>;
138
156template <typename Base, typename Derive>
157concept ExtendsOf = std::derived_from<Derive, Base> || std::is_same_v<Base, Derive>;
158
159} // namespace original
160
161#endif // TYPES_H
Validates callback signature compatibility.
Definition types.h:53
Requires type to support all comparison operators.
Definition types.h:29
Combines Comparable and CallbackOf for comparison callbacks.
Definition types.h:76
Constraint for predicate callbacks.
Definition types.h:97
Checks derivation or type identity.
Definition types.h:157
Constraint for mutating operations.
Definition types.h:117
Checks inheritance or type equality.
Definition types.h:137
Main namespace for the project Original.
Definition algorithms.h:21