Tatooine
tags.h
Go to the documentation of this file.
1#ifndef TATOOINE_TAGS_H
2#define TATOOINE_TAGS_H
3//==============================================================================
4#include <concepts>
5//==============================================================================
6namespace tatooine {
7//==============================================================================
8struct forward_tag {};
9static constexpr forward_tag forward;
10struct backward_tag {};
11static constexpr backward_tag backward;
12template <typename T>
13concept forward_or_backward_tag = (std::same_as<T, forward_tag>) ||
14 (std::same_as<T, backward_tag>);
15constexpr auto opposite(forward_tag const /*tag*/) { return backward_tag{}; }
16constexpr auto opposite(backward_tag const /*tag*/) { return forward_tag{}; }
17auto constexpr operator==(forward_tag const /*rhs*/,
18 backward_tag const /*rhs*/) {
19 return false;
20}
21auto constexpr operator==(backward_tag const /*rhs*/,
22 forward_tag const /*rhs*/) {
23 return false;
24}
25auto constexpr operator==(forward_tag const /*rhs*/,
26 forward_tag const /*rhs*/) {
27 return true;
28}
29auto constexpr operator==(backward_tag const /*rhs*/,
30 backward_tag const /*rhs*/) {
31 return true;
32}
34 forward_or_backward_tag auto const rhs) {
35 return !(lhs == rhs);
36}
37// template <typename T>
38// struct is_forward_impl : std::false_type {};
39// template <>
40// struct is_forward_impl<forward_tag> : std::false_type {};
41// template <typename T>
42// static constexpr auto is_forward = is_forward_impl<T>::value;
43template <typename T>
44concept is_forward = std::same_as<forward_tag, std::decay_t<T>>;
45template <typename T>
46concept is_backward = std::same_as<backward_tag, std::decay_t<T>>;
47
48// template <typename T>
49// struct is_backward_impl : std::false_type {};
50// template <>
51// struct is_backward_impl<backward_tag> : std::false_type {};
52// template <typename T>
53// static constexpr auto is_backward = is_backward_impl<T>::value;
54//==============================================================================
55} // namespace tatooine
56//==============================================================================
58//==============================================================================
59struct parallel_t {};
60static constexpr parallel_t parallel;
61// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
62struct sequential_t {};
63static constexpr sequential_t sequential;
64template <typename T>
65concept policy = std::same_as<T, parallel_t> || std::same_as<T, sequential_t>;
66//==============================================================================
67} // namespace tatooine::execution_policy
68//==============================================================================
69namespace tatooine {
70//==============================================================================
71template <typename T>
74//==============================================================================
75} // namespace tatooine
76namespace tatooine::tag {
77//==============================================================================
78struct frobenius_t {};
79static constexpr frobenius_t frobenius;
80struct full_t {};
81static constexpr full_t full;
82struct economy_t {};
83static constexpr economy_t economy;
84struct eye_t {};
85static constexpr eye_t eye;
86struct automatic_t {};
87static constexpr automatic_t automatic;
88struct quadratic_t {};
89static constexpr quadratic_t quadratic;
90struct analytical_t {};
91static constexpr analytical_t analytical;
92struct numerical_t {};
93static constexpr numerical_t numerical;
94
95template <typename Real>
96struct fill {
97 Real value;
98};
99template <typename Real>
101
102struct zeros_t {};
103static constexpr zeros_t zeros;
104
105struct ones_t {};
106static constexpr ones_t ones;
107//==============================================================================
108} // namespace tatooine::tag
109//==============================================================================
110namespace tatooine {
111struct heap {};
112struct stack {};
113template <typename T>
114concept memory_location = std::same_as<T, heap> || std::same_as<T, stack>;
115} // namespace tatooine
116#endif
Definition: tags.h:72
Definition: tags.h:46
Definition: tags.h:44
Definition: tags.h:114
Definition: concepts.h:15
Definition: tags.h:57
static constexpr sequential_t sequential
Definition: tags.h:63
static constexpr parallel_t parallel
Definition: tags.h:60
Definition: tags.h:76
static constexpr quadratic_t quadratic
Definition: tags.h:89
static constexpr economy_t economy
Definition: tags.h:83
static constexpr analytical_t analytical
Definition: tags.h:91
static constexpr full_t full
Definition: tags.h:81
static constexpr zeros_t zeros
Definition: tags.h:103
static constexpr automatic_t automatic
Definition: tags.h:87
static constexpr numerical_t numerical
Definition: tags.h:93
static constexpr ones_t ones
Definition: tags.h:106
static constexpr eye_t eye
Definition: tags.h:85
static constexpr frobenius_t frobenius
Definition: tags.h:79
Definition: algorithm.h:6
auto operator!=(forward_or_backward_tag auto const lhs, forward_or_backward_tag auto const rhs)
Definition: tags.h:33
auto constexpr operator==(forward_tag const, backward_tag const)
Definition: tags.h:17
constexpr auto opposite(forward_tag const)
Definition: tags.h:15
static constexpr backward_tag backward
Definition: tags.h:11
static constexpr forward_tag forward
Definition: tags.h:9
Definition: tags.h:10
Definition: tags.h:8
Definition: tags.h:111
Definition: tags.h:112
Definition: tags.h:90
Definition: tags.h:86
Definition: tags.h:82
Definition: tags.h:84
Definition: tags.h:96
Real value
Definition: tags.h:97
Definition: tags.h:78
Definition: tags.h:80
Definition: tags.h:92
Definition: tags.h:105
Definition: tags.h:88
Definition: tags.h:102