PhysicsBasedAnimationToolkit 0.0.10
Cross-platform C++20 library of algorithms and data structures commonly used in computer graphics research on physically-based simulation.
Loading...
Searching...
No Matches
Concepts.h
Go to the documentation of this file.
1
9
10#ifndef PBAT_COMMON_CONCEPTS_H
11#define PBAT_COMMON_CONCEPTS_H
12
13#include <concepts>
14#include <iterator>
15#include <pbat/Aliases.h>
16#include <ranges>
17#include <type_traits>
18
19namespace pbat {
20namespace common {
21
30template <class T>
31concept CArithmetic = std::is_arithmetic_v<T>;
32
44template <class T>
45concept CIndex = std::is_integral_v<T> and not std::is_same_v<T, bool>;
46
55template <class T>
56concept CFloatingPoint = std::is_floating_point_v<T>;
57
63template <class R>
64concept CIndexRange =
65 std::ranges::range<R> && std::is_convertible_v<std::ranges::range_value_t<R>, int>;
66
72template <class R>
74 CIndexRange<R> && std::ranges::sized_range<R> && std::ranges::contiguous_range<R>;
75
81template <class R>
83 std::ranges::range<R> && std::is_arithmetic_v<std::ranges::range_value_t<R>>;
84
90template <class R>
92 CArithmeticRange<R> && std::ranges::sized_range<R> && std::ranges::contiguous_range<R>;
93
99template <class R>
100concept CContiguousArithmeticMatrixRange = requires(R r)
101{
102 requires std::ranges::range<R>;
103 requires std::ranges::sized_range<R>;
104 requires std::ranges::contiguous_range<R>;
105 {std::ranges::range_value_t<R>::RowsAtCompileTime}->std::convertible_to<int>;
106 {std::ranges::range_value_t<R>::ColsAtCompileTime}->std::convertible_to<int>;
107 requires std::is_arithmetic_v<typename std::ranges::range_value_t<R>::Scalar>;
108 {std::ranges::range_value_t<R>::Flags};
109};
110
111} // namespace common
112} // namespace pbat
113
114#endif // PBAT_COMMON_CONCEPTS_H
Concept for arithmetic types.
Definition Concepts.h:31
Range of arithmetic types.
Definition Concepts.h:82
Range of Eigen fixed-size matrix types.
Definition Concepts.h:100
Contiguous range of arithmetic types.
Definition Concepts.h:91
Contiguous range of integer types.
Definition Concepts.h:73
Concept for floating-point types.
Definition Concepts.h:56
Concept for integral types.
Definition Concepts.h:45
Range of integer types.
Definition Concepts.h:64
Common functionality.
Definition ArgSort.h:20
The main namespace of the library.
Definition Aliases.h:15