delpi
0.0.1
DElta-complete LP solver
Toggle main menu visibility
Loading...
Searching...
No Matches
concepts.h
1
9
#pragma once
10
11
#include <concepts>
12
13
namespace
delpi
{
14
26
template
<
class
T,
typename
From,
typename
To>
27
concept
MapFromTo
=
requires
(T t) {
28
{ t.at(From{}) } -> std::convertible_to<To>;
29
};
// NOLINT(readability/braces) per C++ standard concept definition
30
42
template
<
class
T>
43
concept
SelfReferenceCounter
=
requires
(T t) {
44
{ t.AddRef() };
// NOLINT(readability/braces) per C++ standard concept definition
45
{ t.Release() };
// NOLINT(readability/braces) per C++ standard concept definition
46
};
// NOLINT(readability/braces) per C++ standard concept definition
47
56
template
<
class
T>
57
concept
Iterable
=
requires
(T t) {
58
{ t.begin() } -> std::convertible_to<typename T::iterator>;
59
{ t.end() } -> std::convertible_to<typename T::iterator>;
60
};
// NOLINT(readability/braces) per C++ standard concept definition
61
70
template
<
class
T>
71
concept
SizedIterable
=
requires
(T t) {
72
{ t.begin() } -> std::convertible_to<typename T::iterator>;
73
{ t.end() } -> std::convertible_to<typename T::iterator>;
74
{ t.size() } -> std::convertible_to<std::size_t>;
75
};
// NOLINT(readability/braces) per C++ standard concept definition
76
86
template
<
typename
T,
typename
U>
87
concept
TypedIterable
=
requires
(T t, U u) {
88
{ t.begin() } -> std::convertible_to<typename T::iterator>;
89
{ t.end() } -> std::convertible_to<typename T::iterator>;
90
} && std::convertible_to<typename T::value_type, U>;
91
101
template
<
typename
T,
typename
U>
102
concept
SizedTypedIterable
=
requires
(T t, U u) {
103
{ t.begin() } -> std::convertible_to<typename T::iterator>;
104
{ t.end() } -> std::convertible_to<typename T::iterator>;
105
{ t.size() } -> std::convertible_to<std::size_t>;
106
} && std::convertible_to<typename T::value_type, U>;
107
117
template
<
typename
T,
typename
... U>
118
concept
IsAnyOf
= (std::same_as<T, U> || ...);
119
129
template
<
typename
T,
typename
... U>
130
concept
IsNotAnyOf
= !
IsAnyOf
<T, U...>;
131
140
template
<
class
T>
141
concept
Arithmetic
=
requires
(T a, T b) {
142
{ a + b } -> std::convertible_to<T>;
143
{ a - b } -> std::convertible_to<T>;
144
{ a* b } -> std::convertible_to<T>;
145
{ a / b } -> std::convertible_to<T>;
146
};
// NOLINT(readability/braces) per C++ standard concept definition
147
157
template
<
class
T>
158
concept
Numeric
= std::totally_ordered<T> &&
Arithmetic<T>
;
159
160
}
// namespace delpi
delpi::Arithmetic
Check if the type T supports the arithmetic operations +, -, *, /.
Definition
concepts.h:141
delpi::IsAnyOf
Check if the type T is any of the types U.
Definition
concepts.h:118
delpi::IsNotAnyOf
Check if the type T is not any of the types U.
Definition
concepts.h:130
delpi::Iterable
Check if the type T is an iterable type.
Definition
concepts.h:57
delpi::MapFromTo
Check if the type T constitutes a map from type From to type To.
Definition
concepts.h:27
delpi::Numeric
Check if the type T supports the arithmetic operations +, -, *, / and the comparison operators <,...
Definition
concepts.h:158
delpi::SelfReferenceCounter
Check if the type T is a self-reference counter type.
Definition
concepts.h:43
delpi::SizedIterable
Check if the type T is an iterable type with a size() method.
Definition
concepts.h:71
delpi::SizedTypedIterable
Check if the type T is an iterable type with elements of type U and a size() method.
Definition
concepts.h:102
delpi::TypedIterable
Check if the type T is an iterable type with elements of type U.
Definition
concepts.h:87
delpi
Global namespace for the delpi library.
delpi
util
concepts.h
Generated by
1.17.0