1#ifndef KOKKOS_EXECUTION_IMPL_ENV_HPP
2#define KOKKOS_EXECUTION_IMPL_ENV_HPP
7#define KOKKOS_EXECUTION_FORWARDING_GET_ENV(_type_, _obj_) \
9 constexpr auto get_env() const noexcept -> ::stdexec::__fwd_env_t<::stdexec::env_of_t<_type_>> { \
10 return ::stdexec::__fwd_env(::stdexec::get_env(_obj_)); \
20 template <
typename Env1,
typename Env2>
25 template <
typename Env>
29 template <
typename Tag,
typename PropValue,
typename Value>
30 constexpr auto operator()(Tag tag, stdexec::prop<Tag, PropValue>, Value&& value)
const noexcept {
31 return stdexec::prop{tag, std::forward<Value>(value)};
35 template <
typename Tag,
typename Env,
typename Value>
36 requires(!stdexec::__queryable_with<std::remove_cvref_t<Env>, Tag>)
37 constexpr auto operator()(Tag tag, Env&&
env, Value&& value)
const noexcept {
39 stdexec::prop{tag, std::forward<Value>(value)},
40 std::forward<Env>(
env)
45 template <
typename Tag,
typename PropValue,
typename Value>
46 constexpr auto operator()(Tag tag, stdexec::env<stdexec::prop<Tag, PropValue>>, Value&& value)
const noexcept {
48 stdexec::prop{tag, std::forward<Value>(value)}
53 template <
typename Tag,
typename Env,
typename Value>
54 requires(stdexec::__queryable_with<env1_of_t<std::remove_cvref_t<Env>>, Tag>)
55 constexpr auto operator()(Tag tag, Env&&
env, Value&& value)
const noexcept {
57 stdexec::prop{tag, std::forward<Value>(value)},
58 std::forward<Env>(
env).__env2_
63 template <
typename Tag,
typename Env,
typename Value>
65 stdexec::__queryable_with<std::remove_cvref_t<Env>, Tag>
66 && !stdexec::__queryable_with<env1_of_t<std::remove_cvref_t<Env>>, Tag>)
67 constexpr auto operator()(Tag tag, Env&&
env, Value&& value)
const noexcept {
69 std::forward<Env>(
env).__env1_,
71 tag, std::forward<Env>(
env).__env2_, std::forward<Value>(value))};
75 template <
typename Tag,
typename Env,
typename Value>
77 stdexec::__queryable_with<Env &&, Tag> && stdexec::__env::__is_fwd_env<Env>
82 Value&& value) { self(tag, std::forward<Env>(
env).__env_, std::forward<Value>(value)); })
83 constexpr auto operator()(Tag tag, Env&&
env, Value&& value)
const noexcept {
84 return stdexec::__env::__fwd{this->
operator()(tag, std::forward<Env>(
env).__env_, std::forward<Value>(value))};
89 template <
typename Tag,
typename Env,
typename Value>
90 requires(std::is_invocable_v<UpsertInEnvFn, Tag, Env &&, Value &&>)
91 constexpr auto operator()(Tag tag, Env&&
env, Value&& value)
const noexcept {
92 return UpsertInEnvFn{}.operator()(tag, std::forward<Env>(
env), std::forward<Value>(value));
95 template <
typename Tag,
typename Env,
typename Value>
96 requires(!std::is_invocable_v<UpsertInEnvFn, Tag, Env &&, Value &&>)
97 constexpr auto operator()(Tag tag, Env&&
env, Value&& value)
const noexcept {
98 return stdexec::__env::__join(stdexec::prop{tag, std::forward<Value>(value)}, std::forward<Env>(
env));
102template <
typename Tag,
typename Env,
typename Value>
107template <
typename Tag,
typename Env,
typename Value>
std::invoke_result_t< UpsertInEnvFn, Tag, Env, Value > upsert_in_env_t
constexpr UpsertInEnvFn upsert_in_env
constexpr UpsertInEnvOrJoinFn upsert_in_env_or_join
std::invoke_result_t< UpsertInEnvOrJoinFn, Tag, Env, Value > upsert_in_env_or_join_t
constexpr auto operator()(Tag tag, stdexec::prop< Tag, PropValue >, Value &&value) const noexcept
Handle the case of a stdexec::prop without wrapping it into an stdexec::env.
typename EnvOneOf< std::remove_cvref_t< Env > >::type env1_of_t
constexpr auto operator()(Tag tag, stdexec::env< stdexec::prop< Tag, PropValue > >, Value &&value) const noexcept
The environment contains the required property, possibly with a value mismatch.
Inspired by https://github.com/NVIDIA/stdexec/blob/16076a81efa4477513e6ede9c2741fd034ecef99/include/s...