13template <
typename Arg,
typename Source>
15 !std::is_rvalue_reference_v<Arg> &&
17 std::is_reference_v<Arg> ||
18 std::is_constructible_v<std::remove_cvref_t<Arg>,
Source&>
21template <
typename Arg,
typename Source>
25 std::is_reference_v<Arg> ||
26 std::is_nothrow_constructible_v<std::remove_cvref_t<Arg>,
Source&>
44template <
typename Ctx,
typename T>
48template <
typename Prev,
typename Source>
50 noexcept(std::declval<Prev&>().template
get<Source>());
52template <
typename Arg,
typename T,
typename Ctx>
57template <
typename Arg,
typename T,
typename Prev>
61template <
typename Arg,
typename T,
typename Prev>
65template <
typename T,
typename Prev>
68 std::is_nothrow_constructible_v<
69 std::remove_cvref_t<copy_prev_source_t<T>>,
70 const std::remove_cvref_t<copy_prev_source_t<T>>&>;
72template <
typename Arg,
typename T>
74 std::is_same_v<Arg, std::remove_cvref_t<T>&&> ||
75 std::is_nothrow_constructible_v<std::remove_cvref_t<Arg>, std::remove_cvref_t<T>&&>;
77template <
typename Arg,
typename T,
typename Prev>
82template <
typename Arg,
typename T>
84 std::is_reference_v<Arg> ||
85 std::is_nothrow_constructible_v<std::remove_cvref_t<Arg>,
T&>;
87template <
typename Arg,
typename T>
89 std::is_reference_v<Arg> ||
90 std::is_nothrow_constructible_v<std::remove_cvref_t<Arg>,
const T&>;
96template <
typename Arg,
typename Source>
100template <
typename Arg,
typename T>
102 !std::is_rvalue_reference_v<Arg> &&
105 std::is_reference_v<Arg> &&
106 std::is_const_v<std::remove_reference_t<Arg>> &&
107 std::is_convertible_v<T&, const std::remove_cvref_t<Arg>&>
110 !std::is_reference_v<Arg> &&
111 std::is_constructible_v<std::remove_cvref_t<Arg>, T&>
115template <
typename Arg,
typename T>
117 !std::is_rvalue_reference_v<Arg> &&
120 std::is_reference_v<Arg> &&
121 std::is_const_v<std::remove_reference_t<Arg>> &&
122 std::is_convertible_v<const T&, const std::remove_cvref_t<Arg>&>
125 !std::is_reference_v<Arg> &&
126 std::is_constructible_v<std::remove_cvref_t<Arg>,
const T&>
149template <
typename Arg,
typename Source>
154 "Does not support binding to T&&");
156 using raw_arg_t = std::remove_cvref_t<Arg>;
158 if constexpr (std::is_reference_v<Arg>) {
159 if constexpr (std::is_const_v<std::remove_reference_t<Arg>>) {
160 static_assert(std::is_convertible_v<Source&, const raw_arg_t&>,
161 "Source cannot bind to const reference argument");
162 return static_cast<const raw_arg_t&
>(src);
164 static_assert(std::is_convertible_v<Source&, raw_arg_t&>,
165 "Source cannot bind to non-const reference argument");
166 return static_cast<raw_arg_t&
>(src);
169 static_assert(std::is_constructible_v<raw_arg_t, Source&>,
170 "Source cannot be copied/converted into value argument");
171 return static_cast<raw_arg_t
>(src);
190template <
typename Arg,
typename T,
typename Ctx,
typename Prev>
193 static_assert(!std::is_void_v<Ctx>,
194 "from_ctx<T>() cannot be used with exec_context<void>");
198 static_assert(Ctx::template contains<source_t>(),
199 "Requested type is not present in the context");
201 auto& src = ec.
ctx.template get<source_t>();
202 return bind_from_lvalue<Arg>(src);
219template <
typename Arg,
typename T,
typename Ctx,
typename Prev>
223 using prev_t = std::remove_cvref_t<
decltype(ec.
prev_view())>;
225 static_assert(std::is_same_v<Arg, const source_t&>,
226 "borrow_prev<T>() only binds to const T&");
227 static_assert(prev_t::template contains<source_t>(),
228 "borrow_prev<T>() requires a direct parent slot carrying the requested type");
230 auto& src = ec.
prev_view().template get<source_t>();
231 return static_cast<const source_t&
>(src);
241template <
typename Arg,
typename T,
typename Ctx,
typename Prev>
245 using prev_t = std::remove_cvref_t<
decltype(ec.
prev_view())>;
246 using prev_ref_t =
decltype(std::declval<Prev&>().template get<source_t>());
248 static_assert(std::is_same_v<Arg, source_t&>,
249 "borrow_prev_mut<T>() only binds to T&");
250 static_assert(prev_t::template contains<source_t>(),
251 "borrow_prev_mut<T>() requires a direct parent slot carrying the requested type");
252 static_assert(!std::is_const_v<std::remove_reference_t<prev_ref_t>>,
253 "borrow_prev_mut<T>() requires a mutable direct parent payload source");
255 auto& src = ec.
prev_view().template get<source_t>();
256 return static_cast<source_t&
>(src);
266template <
typename Arg,
typename T,
typename Ctx,
typename Prev>
270 using prev_t = std::remove_cvref_t<
decltype(ec.
prev_view())>;
272 static_assert(std::is_same_v<Arg, source_t>,
273 "copy_prev<T>() only binds to T");
274 static_assert(prev_t::template contains<source_t>(),
275 "copy_prev<T>() requires a direct parent slot carrying the requested type");
276 static_assert(std::is_constructible_v<source_t, const source_t&>,
277 "copy_prev<T>() requires T to be constructible from const T&");
279 auto& src = ec.
prev_view().template get<source_t>();
280 return static_cast<source_t
>(
static_cast<const source_t&
>(src));
290template <
typename Arg,
typename T,
typename Ctx,
typename Prev>
294 using prev_t = std::remove_cvref_t<
decltype(ec.
prev_view())>;
295 using prev_ref_t =
decltype(std::declval<Prev&>().template get<source_t>());
297 static_assert(std::is_same_v<Arg, source_t> || std::is_same_v<Arg, source_t&&>,
298 "consume_prev<T>() only binds to T or T&&");
299 static_assert(prev_t::template contains<source_t>(),
300 "consume_prev<T>() requires a direct parent slot carrying the requested type");
301 static_assert(!std::is_const_v<std::remove_reference_t<prev_ref_t>>,
302 "consume_prev<T>() requires a mutable direct parent payload source");
304 auto& src = ec.
prev_view().template get<source_t>();
306 if constexpr (std::is_same_v<Arg, source_t&&>) {
307 return static_cast<source_t&&
>(src);
309 return static_cast<source_t
>(std::move(src));
332template <
typename Arg,
typename T,
typename Ctx,
typename Prev>
334 noexcept(std::is_reference_v<Arg>) {
335 static_assert(std::is_reference_v<Arg>,
336 "value(std::ref(...)) can only bind to T& or const T&");
338 using raw_arg_t = std::remove_cvref_t<Arg>;
339 auto& ref = spec.v.get();
341 if constexpr (std::is_const_v<std::remove_reference_t<Arg>>) {
342 static_assert(std::is_convertible_v<T&, const raw_arg_t&>,
343 "Stored reference_wrapper cannot bind to requested const reference type");
344 return static_cast<const raw_arg_t&
>(ref);
346 static_assert(std::is_convertible_v<T&, raw_arg_t&>,
347 "Stored reference_wrapper cannot bind to requested mutable reference type");
348 return static_cast<raw_arg_t&
>(ref);
352template <
typename Arg,
typename T,
typename Ctx,
typename Prev>
354 noexcept(std::is_reference_v<Arg>) {
355 static_assert(std::is_reference_v<Arg>,
356 "const value(std::ref(...)) can only bind to T& or const T&");
358 using raw_arg_t = std::remove_cvref_t<Arg>;
359 auto& ref = spec.v.get();
361 if constexpr (std::is_const_v<std::remove_reference_t<Arg>>) {
362 static_assert(std::is_convertible_v<T&, const raw_arg_t&>,
363 "Stored reference_wrapper cannot bind to requested const reference type");
364 return static_cast<const raw_arg_t&
>(ref);
366 static_assert(std::is_convertible_v<T&, raw_arg_t&>,
367 "Stored reference_wrapper cannot bind to requested mutable reference type");
368 return static_cast<raw_arg_t&
>(ref);
372template <
typename Arg,
typename T,
typename Ctx,
typename Prev>
373 requires resolvable_mutable_value<Arg, T>
376 static_assert(!std::is_rvalue_reference_v<Arg>,
377 "Does not support binding value(...) to T&&");
379 using raw_arg_t = std::remove_cvref_t<Arg>;
381 if constexpr (std::is_reference_v<Arg>) {
382 static_assert(std::is_const_v<std::remove_reference_t<Arg>>,
383 "value(...) can only bind to T or const T&");
384 static_assert(std::is_convertible_v<T&, const raw_arg_t&>,
385 "Stored value cannot bind to requested const reference type");
386 return static_cast<const raw_arg_t&
>(spec.
v);
388 static_assert(std::is_constructible_v<raw_arg_t, T&>,
389 "Stored value cannot be copied/converted into value argument");
390 return static_cast<raw_arg_t
>(spec.
v);
410template <
typename Arg,
typename T,
typename Ctx,
typename Prev>
411 requires resolvable_const_value<Arg, T>
414 static_assert(!std::is_rvalue_reference_v<Arg>,
415 "Does not support binding value(...) to T&&");
417 using raw_arg_t = std::remove_cvref_t<Arg>;
419 if constexpr (std::is_reference_v<Arg>) {
420 static_assert(std::is_const_v<std::remove_reference_t<Arg>>,
421 "const value(...) can only bind to T or const T&");
422 static_assert(std::is_convertible_v<const T&, const raw_arg_t&>,
423 "Stored value cannot bind to requested const reference type");
424 return static_cast<const raw_arg_t&
>(spec.
v);
426 static_assert(std::is_constructible_v<raw_arg_t, const T&>,
427 "Stored value cannot be copied/converted into value argument");
428 return static_cast<raw_arg_t
>(spec.
v);
443template <
typename Arg,
typename Spec,
typename Ctx,
typename Prev>
447 "Unsupported spec in resolve_as");
constexpr bool consume_bind_nothrow_v
typename borrow_prev_t< T >::type borrow_prev_source_t
typename borrow_prev_mut_t< T >::type borrow_prev_mut_source_t
typename copy_prev_t< T >::type copy_prev_source_t
constexpr bool always_false_v
constexpr bool resolve_const_value_nothrow_v
constexpr bool resolve_borrow_prev_nothrow_v
constexpr bool supports_bind_from_lvalue_v
constexpr bool resolve_value_nothrow_v
constexpr bool resolve_borrow_prev_mut_nothrow_v
typename consume_prev_t< T >::type consume_prev_source_t
constexpr bool resolve_consume_prev_nothrow_v
typename from_ctx_t< T >::type from_ctx_source_t
constexpr bool resolve_from_ctx_nothrow_v
constexpr bool prev_get_source_nothrow_v
constexpr bool is_adapter_descriptor_v
constexpr bool resolve_copy_prev_nothrow_v
constexpr bool ctx_get_nothrow_v
constexpr bool bind_from_lvalue_nothrow_v
constexpr decltype(auto) resolve_as(from_ctx_t< T >, exec_context< Ctx, Prev > &ec) noexcept(detail::resolve_from_ctx_nothrow_v< Arg, T, Ctx >)
Resolves a from_ctx(...) spec by fetching the requested object from the execution context and binding...
constexpr decltype(auto) bind_from_lvalue(Source &src) noexcept(detail::bind_from_lvalue_nothrow_v< Arg, Source >)
Binds an existing lvalue source object to the requested argument type.
Describes a parameter that borrows the direct parent output as T&.
std::remove_cvref_t< T > type
Canonical parent payload type used for lookup.
Describes a parameter that borrows the direct parent output as const T&.
std::remove_cvref_t< T > type
Canonical parent payload type used for lookup.
Describes a parameter that consumes the direct parent output.
std::remove_cvref_t< T > type
Canonical parent payload type used for lookup.
Describes a parameter that copies the direct parent output as T.
std::remove_cvref_t< T > type
Canonical parent payload type used for lookup.
Lightweight borrowed view used during execution.
constexpr Prev & prev_view() &noexcept
Describes a parameter sourced from the execution context by type.
std::remove_cvref_t< T > type
Canonical context key type used for lookup.
Stores a concrete value inside a spec.
T v
Owned payload forwarded from value(...).