kokkos-execution 0.0.1
Loading...
Searching...
No Matches
enter_scope_sender.hpp
Go to the documentation of this file.
1// NOLINTBEGIN
2/*
3 * SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
4 * Copyright (c) 2025 Robert Leahy. All rights reserved.
5 * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 *
7 * Licensed under the Apache License, Version 2.0 with LLVM Exceptions (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
10 *
11 * https://llvm.org/LICENSE.txt
12 *
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 */
19
20#pragma once
21
22#include <concepts>
23#include <type_traits>
24#include <utility>
25
26#include "exit_scope_sender.hpp"
27#include "stdexec/execution.hpp"
28
30
31template <typename Sender>
32concept enter_scope_sender = ::STDEXEC::sender<Sender>;
33
35
36template <typename Env, typename... Args>
38
39template <typename Env, ::exec::exit_scope_sender_in<Env> Sender>
40struct transform_set_value_impl<Env, Sender> {
41 using type = ::STDEXEC::completion_signatures<::STDEXEC::set_value_t(Sender)>;
42};
43
44template <typename Env>
46 template <typename... Args>
47 using fn = transform_set_value_impl<Env, Args...>::type;
48};
49
50template <typename T>
51using transform_set_error = ::STDEXEC::completion_signatures<>;
52
53template <typename Signatures>
54struct impl;
55
56template <typename Sender>
57struct impl<::STDEXEC::completion_signatures<::STDEXEC::set_value_t(Sender)>> {
58 using type = Sender;
59};
60
61} // namespace detail::exit_scope_sender_of
62
63template <enter_scope_sender Constructor, typename Env>
64using exit_scope_sender_of_t = detail::exit_scope_sender_of::impl<::STDEXEC::transform_completion_signatures<
65 ::STDEXEC::completion_signatures_of_t<Constructor, Env>,
66 ::STDEXEC::completion_signatures<>,
69 ::STDEXEC::completion_signatures<>
70>>::type;
71
72template <typename Sender, typename Env>
73concept enter_scope_sender_in = enter_scope_sender<Sender> && ::STDEXEC::sender_in<Sender, Env>
74 && requires { typename exit_scope_sender_of_t<Sender, Env>; };
75
76} // namespace experimental::execution
77
78// NOLINTEND
detail::exit_scope_sender_of::impl<::stdexec::transform_completion_signatures< ::stdexec::completion_signatures_of_t< Constructor, Env >, ::stdexec::completion_signatures<>, detail::exit_scope_sender_of::transform_set_value< Env >::template fn, detail::exit_scope_sender_of::transform_set_error, ::stdexec::completion_signatures<> > >::type exit_scope_sender_of_t