flippy
a c++20 package for dynamically triangulated membrane simulations.
Loading...
Searching...
No Matches
custom_concepts.hpp
Go to the documentation of this file.
1#ifndef FLIPPY_CUSTOM_CONCEPTS_HPP
2#define FLIPPY_CUSTOM_CONCEPTS_HPP
3#include <concepts>
8namespace fp{
24 template<class T> concept floating_point_number = std::is_floating_point_v<T>;
25
31 template<class T> concept indexing_number = std::is_unsigned_v<T> && std::is_integral_v<T>;
34 using Index = unsigned int;
35 using Real = double;
36
37
38 namespace implementation {
39 template<typename C> concept Beginable= requires(C c) { std::begin(c); };
40 template<typename C> concept Endable= requires(C c) { std::end(c); };
41 template<typename C> concept NeqableBeginAndEnd = requires(C c) {{ std::begin(c) != std::end(c) } -> std::same_as<bool>; };
42 template<typename C> concept BeginIncrementable = requires(C c) { std::begin(c)++; };
43 template<typename C> concept BeginDerefable = requires(C c) { *std::begin(c); };
44 template<typename C> concept BeginDerefToVoid = requires(C c) {{ *std::begin(c) } -> std::same_as<void>; };
45 template<typename C> concept BeginAndEndCopyConstructibleAndDestructible = requires(C c) {
46 requires std::destructible<decltype(std::begin(c))> &&
47 std::destructible<decltype(std::end(c))> &&
48 std::copy_constructible<decltype(std::begin(c))> &&
49 std::copy_constructible<decltype(std::end(c))>;
50 };
51
52
53
54 }
55 template<typename C> concept Container =
63
64
65 static Real operator"" _r(long double value) {
66 return static_cast<Real>(value);
67 }
68 static Real operator"" _r(unsigned long long value) {
69 return static_cast<Real>(value);
70 }
71
72 static constexpr auto PI = static_cast<Real>(3.14159265358979323846264338327950288);
73}
74
75
76
77#endif //FLIPPY_CUSTOM_CONCEPTS_HPP
Definition custom_concepts.hpp:55
Here we implement the concepts of a floating point number.
Definition custom_concepts.hpp:24
Definition custom_concepts.hpp:44
Definition custom_concepts.hpp:43
Definition custom_concepts.hpp:42
Definition custom_concepts.hpp:39
Definition custom_concepts.hpp:40
Definition custom_concepts.hpp:41
Here we implement the concepts of a positive integer number that is used throughout the code for inde...
Definition custom_concepts.hpp:31
Definition custom_concepts.hpp:8