Stratax
Scientific computing containers and operations
Toggle main menu visibility
Loading...
Searching...
No Matches
Concepts.hpp
Go to the documentation of this file.
1
#pragma once
2
3
#include <concepts>
4
#include <complex>
5
#include <type_traits>
6
7
#include "
Types.hpp
"
8
9
namespace
stratax::core::concept_detail
{
10
16
template
<
typename
T>
17
using
clean_t
= std::remove_cvref_t<T>;
18
19
template
<
typename
T,
typename
... Candidates>
20
concept
SameAsAny
=
21
(std::same_as<clean_t<T>, Candidates> || ...);
22
23
template
<
typename
T>
24
concept
CharacterLike
=
25
SameAsAny
<
26
T,
27
char,
28
signed
char,
29
unsigned
char,
30
wchar_t,
31
char8_t,
32
char16_t,
33
char32_t
>;
34
35
template
<
typename
T>
36
concept
BoolLike
=
37
std::same_as<clean_t<T>,
bool
>;
38
39
template
<
typename
T>
40
concept
SupportedComplex
=
41
SameAsAny
<
42
T,
43
std::complex<float>,
44
std::complex<double>,
45
std::complex<long double>>;
46
47
}
48
54
template
<
typename
T>
55
concept
Integral
=
56
std::integral<stratax::core::concept_detail::clean_t<T>> &&
57
!
stratax::core::concept_detail::BoolLike<T>
&&
58
!
stratax::core::concept_detail::CharacterLike<T>
;
59
68
template
<
typename
T>
69
concept
Integer
=
70
Integral<T>
;
71
80
template
<
typename
T>
81
concept
SignedInteger
=
82
Integral<T>
&&
83
std::signed_integral<stratax::core::concept_detail::clean_t<T>>;
84
92
template
<
typename
T>
93
concept
UnsignedInteger
=
94
Integral<T>
&&
95
std::unsigned_integral<stratax::core::concept_detail::clean_t<T>>;
96
102
template
<
typename
T>
103
concept
Floating
=
104
std::floating_point<stratax::core::concept_detail::clean_t<T>>;
105
111
template
<
typename
T>
112
concept
Float
=
113
Floating<T>
;
114
120
template
<
typename
T>
121
concept
Arithmetic
=
122
Integral<T>
||
123
Floating<T>
;
124
133
template
<
typename
T>
134
concept
Real
=
135
Arithmetic<T>
;
136
142
template
<
typename
T>
143
concept
Complex
=
144
stratax::core::concept_detail::SupportedComplex<T>
;
145
151
template
<
typename
T>
152
concept
Numeric
=
153
Arithmetic<T>
||
154
Complex<T>
;
155
161
template
<
typename
T>
162
concept
Scalar
=
163
Numeric<T>
;
164
165
namespace
stratax::container
{
166
167
template
<
typename
T>
168
requires
Numeric<T>
169
class
Vector;
170
171
template
<
typename
T>
172
requires
Numeric<T>
173
class
Matrix;
174
175
template
<
typename
T>
176
requires
Numeric<T>
177
class
Tensor;
178
179
}
180
186
template
<
typename
T>
187
struct
is_array
: std::false_type {};
188
189
template
<
typename
T>
190
requires
Numeric<T>
191
struct
is_array
<
stratax
::container::Vector<T>> : std::true_type {};
192
193
template
<
typename
T>
194
requires
Numeric<T>
195
struct
is_array
<
stratax
::container::Matrix<T>> : std::true_type {};
196
197
template
<
typename
T>
198
requires
Numeric<T>
199
struct
is_array
<
stratax
::container::Tensor<T>> : std::true_type {};
200
201
template
<
typename
T>
202
concept
Array
=
203
is_array<stratax::core::concept_detail::clean_t<T>
>::value;
204
210
template
<
typename
T>
211
concept
NDarray
=
212
requires
(
stratax::core::concept_detail::clean_t<T>
& a)
213
{
214
a.shape();
215
a.size();
216
217
a.begin();
218
a.end();
219
};
Types.hpp
Arithmetic
Matches arithmetic scalar types.
Definition
Concepts.hpp:121
Array
Definition
Concepts.hpp:202
Complex
Matches supported complex scalar types.
Definition
Concepts.hpp:143
Float
Alias for Stratax-supported floating-point types.
Definition
Concepts.hpp:112
Floating
Matches floating-point types.
Definition
Concepts.hpp:103
Integer
Alias for Stratax-supported integer types.
Definition
Concepts.hpp:69
Integral
Matches signed and unsigned integral types, excluding character-like types.
Definition
Concepts.hpp:55
NDarray
Matches array-like container types with shape, size, and iteration support.
Definition
Concepts.hpp:211
Numeric
Matches all scalar types supported by Stratax numeric containers.
Definition
Concepts.hpp:152
Real
Matches real numeric scalar types.
Definition
Concepts.hpp:134
Scalar
Alias for any scalar type accepted by Stratax numeric containers.
Definition
Concepts.hpp:162
SignedInteger
Matches supported signed integer types.
Definition
Concepts.hpp:81
UnsignedInteger
Matches supported unsigned integer types.
Definition
Concepts.hpp:93
stratax::core::concept_detail::BoolLike
Definition
Concepts.hpp:36
stratax::core::concept_detail::CharacterLike
Definition
Concepts.hpp:24
stratax::core::concept_detail::SameAsAny
Definition
Concepts.hpp:20
stratax::core::concept_detail::SupportedComplex
Definition
Concepts.hpp:40
stratax::container
Definition
Matrix.hpp:15
stratax::core::concept_detail
Definition
Concepts.hpp:9
stratax::core::concept_detail::clean_t
std::remove_cvref_t< T > clean_t
Removes cv-qualifiers and references from a type.
Definition
Concepts.hpp:17
stratax
Definition
Matrix.hpp:15
is_array
Type trait that reports whether a type is a Stratax array.
Definition
Concepts.hpp:187
include
stratax
core
Concepts.hpp
Generated by
1.17.0