YOrch 1.0.0
Loading...
Searching...
No Matches
prev_access_specs.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <type_traits>
4
5#include "../../detail/bind/traits.hpp"
6#include "../../specs.hpp"
7
8namespace yorch::detail {
9
10enum class prev_access_kind {
11 none,
12 borrow,
14 copy,
15 consume,
16};
17
18template <typename F>
19inline constexpr bool member_receiver_is_const_v =
20 std::is_const_v<std::remove_reference_t<member_receiver_arg_t<F>>>;
21
22template <typename Spec>
25
27 static constexpr bool is_prev_access = false;
28 static constexpr bool is_exclusive = false;
29
30 template <typename Arg>
31 static constexpr bool matches_arg = false;
32
33 template <typename F>
34 static constexpr bool matches_member_receiver = false;
35};
36
37template <typename T>
40
42 static constexpr bool is_prev_access = true;
43 static constexpr bool is_exclusive = false;
44
45 template <typename Arg>
46 static constexpr bool matches_arg =
47 std::is_same_v<Arg, const payload_type&>;
48
49 template <typename F>
50 static constexpr bool matches_member_receiver =
51 std::is_same_v<payload_type, member_class_t<F>> &&
53};
54
55template <typename T>
58
60 static constexpr bool is_prev_access = true;
61 static constexpr bool is_exclusive = true;
62
63 template <typename Arg>
64 static constexpr bool matches_arg =
65 std::is_same_v<Arg, payload_type&>;
66
67 template <typename F>
68 static constexpr bool matches_member_receiver =
69 std::is_same_v<payload_type, member_class_t<F>>;
70};
71
72template <typename T>
75
77 static constexpr bool is_prev_access = true;
78 static constexpr bool is_exclusive = false;
79
80 template <typename Arg>
81 static constexpr bool matches_arg =
82 std::is_same_v<Arg, payload_type>;
83
84 template <typename F>
85 static constexpr bool matches_member_receiver =
86 std::is_same_v<payload_type, member_class_t<F>>;
87};
88
89template <typename T>
92
94 static constexpr bool is_prev_access = true;
95 static constexpr bool is_exclusive = true;
96
97 template <typename Arg>
98 static constexpr bool matches_arg =
99 std::is_same_v<Arg, payload_type> ||
100 std::is_same_v<Arg, payload_type&&>;
101
102 template <typename F>
103 static constexpr bool matches_member_receiver =
104 std::is_same_v<payload_type, member_class_t<F>>;
105};
106
107template <typename Spec>
110
111template <typename Spec>
113 : std::bool_constant<
114 normalized_prev_access_spec_traits<Spec>::kind ==
115 prev_access_kind::borrow> {};
116
117template <typename Spec>
118inline constexpr bool is_borrow_prev_spec_v =
120
121template <typename Spec>
123 : std::bool_constant<
124 normalized_prev_access_spec_traits<Spec>::kind ==
125 prev_access_kind::borrow_mut> {};
126
127template <typename Spec>
128inline constexpr bool is_borrow_prev_mut_spec_v =
130
131template <typename Spec>
133 : std::bool_constant<
134 normalized_prev_access_spec_traits<Spec>::kind ==
135 prev_access_kind::copy> {};
136
137template <typename Spec>
138inline constexpr bool is_copy_prev_spec_v =
140
141template <typename Spec>
143 : std::bool_constant<
144 normalized_prev_access_spec_traits<Spec>::kind ==
145 prev_access_kind::consume> {};
146
147template <typename Spec>
148inline constexpr bool is_consume_prev_spec_v =
150
151template <typename Spec>
152inline constexpr bool is_prev_access_spec_v =
154
155template <typename Spec>
156inline constexpr bool is_exclusive_prev_access_spec_v =
158
159template <typename Spec, typename Arg>
161 : std::bool_constant<
162 normalized_prev_access_spec_traits<Spec>::template matches_arg<Arg>> {};
163
164template <typename Spec, typename Arg>
165inline constexpr bool prev_access_binding_valid_v =
167
168template <typename Spec, typename F>
170 : std::bool_constant<
171 normalized_prev_access_spec_traits<Spec>::template matches_member_receiver<
172 std::remove_cvref_t<F>>> {};
173
174template <typename Spec, typename F>
177
178} // namespace yorch::detail
constexpr bool is_consume_prev_spec_v
constexpr bool is_borrow_prev_spec_v
constexpr bool is_prev_access_spec_v
constexpr bool is_exclusive_prev_access_spec_v
constexpr bool member_receiver_is_const_v
constexpr bool member_receiver_prev_access_valid_v
constexpr bool prev_access_binding_valid_v
constexpr bool is_borrow_prev_mut_spec_v
constexpr bool is_copy_prev_spec_v
constexpr bool is_adapter_descriptor_v
Definition adapters.hpp:63
Describes a parameter that borrows the direct parent output as T&.
Definition specs.hpp:43
std::remove_cvref_t< T > type
Canonical parent payload type used for lookup.
Definition specs.hpp:45
Describes a parameter that borrows the direct parent output as const T&.
Definition specs.hpp:30
std::remove_cvref_t< T > type
Canonical parent payload type used for lookup.
Definition specs.hpp:32
Describes a parameter that consumes the direct parent output.
Definition specs.hpp:69
std::remove_cvref_t< T > type
Canonical parent payload type used for lookup.
Definition specs.hpp:71
Describes a parameter that copies the direct parent output as T.
Definition specs.hpp:56
std::remove_cvref_t< T > type
Canonical parent payload type used for lookup.
Definition specs.hpp:58
static constexpr prev_access_kind kind