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