11module ;
22
3+ #include < atomic>
34#include < concepts>
45#include < expected>
56#include < optional>
@@ -84,6 +85,8 @@ namespace concurrency {
8485struct injection {
8586 bool fence_before = false ;
8687 bool fence_after = false ;
88+ std::memory_order order_before = std::memory_order_seq_cst;
89+ std::memory_order order_after = std::memory_order_seq_cst;
8790};
8891
8992template <typename Policy, typename OpTag, typename CommonRep,
@@ -94,6 +97,17 @@ struct handler {
9497 using result_type = std::expected<CommonRep, ErrorPayload>;
9598
9699 static constexpr auto inject () noexcept -> injection_type { return {}; }
100+
101+ static constexpr auto load (CommonRep const &) noexcept -> CommonRep {
102+ return CommonRep{};
103+ }
104+
105+ static constexpr auto store (CommonRep &, CommonRep) noexcept -> void {}
106+
107+ static constexpr auto compare_exchange (CommonRep &, CommonRep &,
108+ CommonRep) noexcept -> bool {
109+ return false ;
110+ }
97111};
98112
99113template <typename Policy, typename OpTag, typename CommonRep,
@@ -126,6 +140,36 @@ concept handler_available = requires {
126140 requires handler_protocol<Policy, OpTag, CommonRep, ErrorPayload>;
127141};
128142
143+ template <typename Policy, typename CommonRep,
144+ typename ErrorPayload = error::kind>
145+ concept handler_access_protocol = requires {
146+ requires concurrency_policy<Policy>;
147+ {
148+ handler<Policy, void , CommonRep, ErrorPayload>::enabled
149+ } -> std::convertible_to<bool >;
150+ requires handler<Policy, void , CommonRep, ErrorPayload>::enabled;
151+ {
152+ handler<Policy, void , CommonRep, ErrorPayload>::load (
153+ std::declval<CommonRep const &>())
154+ } noexcept -> std::same_as<CommonRep>;
155+ {
156+ handler<Policy, void , CommonRep, ErrorPayload>::store (
157+ std::declval<CommonRep &>(), std::declval<CommonRep>())
158+ } noexcept -> std::same_as<void >;
159+ {
160+ handler<Policy, void , CommonRep, ErrorPayload>::compare_exchange (
161+ std::declval<CommonRep &>(), std::declval<CommonRep &>(),
162+ std::declval<CommonRep>())
163+ } noexcept -> std::same_as<bool >;
164+ };
165+
166+ template <typename Policy, typename CommonRep,
167+ typename ErrorPayload = error::kind>
168+ concept handler_access_available = requires {
169+ requires handler<Policy, void , CommonRep, ErrorPayload>::enabled;
170+ requires handler_access_protocol<Policy, CommonRep, ErrorPayload>;
171+ };
172+
129173} // namespace concurrency
130174
131175namespace type {
0 commit comments