1 /*
2  * Copyright (c) 2022 NVIDIA Corporation
3  *
4  * Licensed under the Apache License Version 2.0 with LLVM Exceptions
5  * (the "License"); you may not use this file except in compliance with
6  * the License. You may obtain a copy of the License at
7  *
8  *   https://llvm.org/LICENSE.txt
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 #pragma once
17 
18 // Internal header, do not include directly
19 
20 #ifdef STDEXEC_DISABLE_STD_DEPRECATIONS
21 #define STDEXEC_STD_DEPRECATED
22 #else
23 #define STDEXEC_STD_DEPRECATED                                                 \
24     [[deprecated(                                                              \
25         "Please access this entity in the ::stdexec:: namespace. Define STDEXEC_DISABLE_STD_DEPRECATIONS to silence this warning.")]]
26 #endif
27 
28 namespace std
29 {
30 //////////////////////////////////////////////////////////////////////////////
31 // <functional>
32 STDEXEC_STD_DEPRECATED
33 inline constexpr stdexec::tag_invoke_t tag_invoke{};
34 
35 template <class _Tag, class... _Ts>
36 using tag_invoke_result STDEXEC_STD_DEPRECATED =
37     stdexec::tag_invoke_result<_Tag, _Ts...>;
38 
39 template <class _Tag, class... _Ts>
40 using tag_invoke_result_t STDEXEC_STD_DEPRECATED =
41     stdexec::tag_invoke_result_t<_Tag, _Ts...>;
42 
43 template <class _Tag, class... _Ts>
44 concept tag_invocable /*STDEXEC_STD_DEPRECATED*/ =
45     stdexec::tag_invocable<_Tag, _Ts...>;
46 
47 template <class _Tag, class... _Ts>
48 concept nothrow_tag_invocable /*STDEXEC_STD_DEPRECATED*/ =
49     stdexec::nothrow_tag_invocable<_Tag, _Ts...>;
50 
51 template <auto& _Tag>
52 using tag_t STDEXEC_STD_DEPRECATED = stdexec::tag_t<_Tag>;
53 
54 //////////////////////////////////////////////////////////////////////////////
55 // <stop_token>
56 template <class _Token>
57 concept stoppable_token /*STDEXEC_STD_DEPRECATED*/ =
58     stdexec::stoppable_token<_Token>;
59 
60 template <class _Token, typename _Callback, typename _Initializer = _Callback>
61 concept stoppable_token_for /*STDEXEC_STD_DEPRECATED*/ =
62     stdexec::stoppable_token_for<_Token, _Callback, _Initializer>;
63 
64 template <class _Token>
65 concept unstoppable_token /*STDEXEC_STD_DEPRECATED*/ =
66     stdexec::unstoppable_token<_Token>;
67 
68 using never_stop_token STDEXEC_STD_DEPRECATED = stdexec::never_stop_token;
69 using in_place_stop_token STDEXEC_STD_DEPRECATED = stdexec::in_place_stop_token;
70 using in_place_stop_source STDEXEC_STD_DEPRECATED =
71     stdexec::in_place_stop_source;
72 
73 template <class _Callback>
74 using in_place_stop_callback STDEXEC_STD_DEPRECATED =
75     stdexec::in_place_stop_callback<_Callback>;
76 
77 //////////////////////////////////////////////////////////////////////////////
78 // <execution>
79 namespace execution
80 {
81 // [exec.queries], general queries
82 using get_scheduler_t STDEXEC_STD_DEPRECATED = stdexec::get_scheduler_t;
83 using get_delegatee_scheduler_t STDEXEC_STD_DEPRECATED =
84     stdexec::get_delegatee_scheduler_t;
85 using get_allocator_t STDEXEC_STD_DEPRECATED = stdexec::get_allocator_t;
86 using get_stop_token_t STDEXEC_STD_DEPRECATED = stdexec::get_stop_token_t;
87 STDEXEC_STD_DEPRECATED
88 inline constexpr stdexec::get_scheduler_t get_scheduler{};
89 STDEXEC_STD_DEPRECATED
90 inline constexpr stdexec::get_delegatee_scheduler_t get_delegatee_scheduler{};
91 STDEXEC_STD_DEPRECATED
92 inline constexpr stdexec::get_allocator_t get_allocator{};
93 STDEXEC_STD_DEPRECATED
94 inline constexpr stdexec::get_stop_token_t get_stop_token{};
95 
96 template <class _StopTokenProvider>
97 using stop_token_of_t STDEXEC_STD_DEPRECATED =
98     stdexec::stop_token_of_t<_StopTokenProvider>;
99 
100 // [exec.env], execution environments
101 using no_env STDEXEC_STD_DEPRECATED = stdexec::no_env;
102 using get_env_t STDEXEC_STD_DEPRECATED = stdexec::get_env_t;
103 // using forwarding_env_query_t STDEXEC_STD_DEPRECATED =
104 // stdexec::forwarding_env_query_t; // BUGBUG
105 STDEXEC_STD_DEPRECATED
106 inline constexpr stdexec::get_env_t get_env{};
107 // inline constexpr stdexec::forwarding_env_query_t forwarding_env_query{}; //
108 // BUGBUG
109 
110 template <class _EnvProvider>
111 using env_of_t STDEXEC_STD_DEPRECATED = stdexec::env_of_t<_EnvProvider>;
112 
113 // [exec.sched], schedulers
114 template <class _Scheduler>
115 concept scheduler /*STDEXEC_STD_DEPRECATED*/ = stdexec::scheduler<_Scheduler>;
116 
117 // [exec.sched_queries], scheduler queries
118 using forward_progress_guarantee STDEXEC_STD_DEPRECATED =
119     stdexec::forward_progress_guarantee;
120 using forwarding_scheduler_query_t STDEXEC_STD_DEPRECATED =
121     stdexec::forwarding_scheduler_query_t;
122 using get_forward_progress_guarantee_t STDEXEC_STD_DEPRECATED =
123     stdexec::get_forward_progress_guarantee_t;
124 STDEXEC_STD_DEPRECATED
125 inline constexpr stdexec::forwarding_scheduler_query_t
126     forwarding_scheduler_query{};
127 STDEXEC_STD_DEPRECATED
128 inline constexpr stdexec::get_forward_progress_guarantee_t
129     get_forward_progress_guarantee{};
130 
131 // [exec.recv], receivers
132 template <class _Receiver>
133 concept receiver /*STDEXEC_STD_DEPRECATED*/ = stdexec::receiver<_Receiver>;
134 
135 template <class _Receiver, class _Completions>
136 concept receiver_of /*STDEXEC_STD_DEPRECATED*/ =
137     stdexec::receiver_of<_Receiver, _Completions>;
138 
139 using set_value_t STDEXEC_STD_DEPRECATED = stdexec::set_value_t;
140 using set_error_t STDEXEC_STD_DEPRECATED = stdexec::set_error_t;
141 using set_stopped_t STDEXEC_STD_DEPRECATED = stdexec::set_stopped_t;
142 STDEXEC_STD_DEPRECATED
143 inline constexpr stdexec::set_value_t set_value{};
144 STDEXEC_STD_DEPRECATED
145 inline constexpr stdexec::set_error_t set_error{};
146 STDEXEC_STD_DEPRECATED
147 inline constexpr stdexec::set_stopped_t set_stopped{};
148 
149 // [exec.recv_queries], receiver queries
150 // using stdexec::forwarding_receiver_query_t; // BUGBUG
151 // using stdexec::forwarding_receiver_query; // BUGBUG
152 
153 // [exec.op_state], operation states
154 template <class _OpState>
155 concept operation_state /*STDEXEC_STD_DEPRECATED*/ =
156     stdexec::operation_state<_OpState>;
157 
158 using start_t STDEXEC_STD_DEPRECATED = stdexec::start_t;
159 STDEXEC_STD_DEPRECATED
160 inline constexpr stdexec::start_t start{};
161 
162 // [exec.snd], senders
163 template <class _Sender, class _Env = stdexec::no_env>
164 concept sender /*STDEXEC_STD_DEPRECATED*/ = stdexec::sender<_Sender, _Env>;
165 
166 template <class _Sender, class _Receiver>
167 concept sender_to /*STDEXEC_STD_DEPRECATED*/ =
168     stdexec::sender_to<_Sender, _Receiver>;
169 
170 template <class _Sender, class _SetSig, class _Env = stdexec::no_env>
171 concept sender_of /*STDEXEC_STD_DEPRECATED*/ =
172     stdexec::sender_of<_Sender, _SetSig, _Env>;
173 
174 // [exec.sndtraits], completion signatures
175 using get_completion_signatures_t STDEXEC_STD_DEPRECATED =
176     stdexec::get_completion_signatures_t;
177 STDEXEC_STD_DEPRECATED
178 inline constexpr stdexec::get_completion_signatures_t
179     get_completion_signatures{};
180 
181 template <class _Sender, class _Env = stdexec::no_env>
182 using completion_signatures_of_t STDEXEC_STD_DEPRECATED =
183     stdexec::completion_signatures_of_t<_Sender, _Env>;
184 
185 template <class _Env>
186 using dependent_completion_signatures STDEXEC_STD_DEPRECATED =
187     stdexec::dependent_completion_signatures<_Env>;
188 
189 template <class _Sender, class _Env = stdexec::no_env,
190           template <class...> class _Tuple = stdexec::__decayed_tuple,
191           template <class...> class _Variant = stdexec::__variant>
192 using value_types_of_t STDEXEC_STD_DEPRECATED =
193     stdexec::value_types_of_t<_Sender, _Env, _Tuple, _Variant>;
194 
195 template <class _Sender, class _Env = stdexec::no_env,
196           template <class...> class _Variant = stdexec::__variant>
197 using error_types_of_t STDEXEC_STD_DEPRECATED =
198     stdexec::error_types_of_t<_Sender, _Env, _Variant>;
199 
200 template <class _Sender, class _Env = stdexec::no_env>
201 STDEXEC_STD_DEPRECATED inline constexpr bool sends_stopped =
202     stdexec::sends_stopped<_Sender, _Env>;
203 
204 // [exec.connect], the connect sender algorithm
205 using connect_t STDEXEC_STD_DEPRECATED = stdexec::connect_t;
206 STDEXEC_STD_DEPRECATED
207 inline constexpr stdexec::connect_t connect{};
208 
209 template <class _Sender, class _Receiver>
210 using connect_result_t STDEXEC_STD_DEPRECATED =
211     stdexec::connect_result_t<_Sender, _Receiver>;
212 
213 // [exec.snd_queries], sender queries
214 using forwarding_sender_query_t STDEXEC_STD_DEPRECATED =
215     stdexec::forwarding_sender_query_t;
216 template <class _Tag>
217 using get_completion_scheduler_t STDEXEC_STD_DEPRECATED =
218     stdexec::get_completion_scheduler_t<_Tag>;
219 STDEXEC_STD_DEPRECATED
220 inline constexpr stdexec::forwarding_sender_query_t forwarding_sender_query{};
221 
222 template <class _Tag>
223 STDEXEC_STD_DEPRECATED inline constexpr stdexec::get_completion_scheduler_t<
224     _Tag>
225     get_completion_scheduler{};
226 
227 // [exec.factories], sender factories
228 using schedule_t STDEXEC_STD_DEPRECATED = stdexec::schedule_t;
229 using transfer_just_t STDEXEC_STD_DEPRECATED = stdexec::transfer_just_t;
230 STDEXEC_STD_DEPRECATED
231 inline constexpr auto just = stdexec::just;
232 STDEXEC_STD_DEPRECATED
233 inline constexpr auto just_error = stdexec::just_error;
234 STDEXEC_STD_DEPRECATED
235 inline constexpr auto just_stopped = stdexec::just_stopped;
236 STDEXEC_STD_DEPRECATED
237 inline constexpr auto schedule = stdexec::schedule;
238 STDEXEC_STD_DEPRECATED
239 inline constexpr auto transfer_just = stdexec::transfer_just;
240 STDEXEC_STD_DEPRECATED
241 inline constexpr auto read = stdexec::read;
242 
243 template <class _Scheduler>
244 using schedule_result_t STDEXEC_STD_DEPRECATED =
245     stdexec::schedule_result_t<_Scheduler>;
246 
247 // [exec.adapt], sender adaptors
248 template <class _Closure>
249 using sender_adaptor_closure STDEXEC_STD_DEPRECATED =
250     stdexec::sender_adaptor_closure<_Closure>;
251 
252 using on_t STDEXEC_STD_DEPRECATED = stdexec::on_t;
253 using transfer_t STDEXEC_STD_DEPRECATED = stdexec::transfer_t;
254 using schedule_from_t STDEXEC_STD_DEPRECATED = stdexec::schedule_from_t;
255 using then_t STDEXEC_STD_DEPRECATED = stdexec::then_t;
256 using upon_error_t STDEXEC_STD_DEPRECATED = stdexec::upon_error_t;
257 using upon_stopped_t STDEXEC_STD_DEPRECATED = stdexec::upon_stopped_t;
258 using let_value_t STDEXEC_STD_DEPRECATED = stdexec::let_value_t;
259 using let_error_t STDEXEC_STD_DEPRECATED = stdexec::let_error_t;
260 using let_stopped_t STDEXEC_STD_DEPRECATED = stdexec::let_stopped_t;
261 using bulk_t STDEXEC_STD_DEPRECATED = stdexec::bulk_t;
262 using split_t STDEXEC_STD_DEPRECATED = stdexec::split_t;
263 using when_all_t STDEXEC_STD_DEPRECATED = stdexec::when_all_t;
264 using when_all_with_variant_t STDEXEC_STD_DEPRECATED =
265     stdexec::when_all_with_variant_t;
266 using transfer_when_all_t STDEXEC_STD_DEPRECATED = stdexec::transfer_when_all_t;
267 using transfer_when_all_with_variant_t STDEXEC_STD_DEPRECATED =
268     stdexec::transfer_when_all_with_variant_t;
269 using into_variant_t STDEXEC_STD_DEPRECATED = stdexec::into_variant_t;
270 using stopped_as_optional_t STDEXEC_STD_DEPRECATED =
271     stdexec::stopped_as_optional_t;
272 using stopped_as_error_t STDEXEC_STD_DEPRECATED = stdexec::stopped_as_error_t;
273 using ensure_started_t STDEXEC_STD_DEPRECATED = stdexec::ensure_started_t;
274 
275 STDEXEC_STD_DEPRECATED
276 inline constexpr auto on = stdexec::on;
277 STDEXEC_STD_DEPRECATED
278 inline constexpr auto transfer = stdexec::transfer;
279 STDEXEC_STD_DEPRECATED
280 inline constexpr auto schedule_from = stdexec::schedule_from;
281 STDEXEC_STD_DEPRECATED
282 inline constexpr auto then = stdexec::then;
283 STDEXEC_STD_DEPRECATED
284 inline constexpr auto upon_error = stdexec::upon_error;
285 STDEXEC_STD_DEPRECATED
286 inline constexpr auto upon_stopped = stdexec::upon_stopped;
287 STDEXEC_STD_DEPRECATED
288 inline constexpr auto let_value = stdexec::let_value;
289 STDEXEC_STD_DEPRECATED
290 inline constexpr auto let_error = stdexec::let_error;
291 STDEXEC_STD_DEPRECATED
292 inline constexpr auto let_stopped = stdexec::let_stopped;
293 STDEXEC_STD_DEPRECATED
294 inline constexpr auto bulk = stdexec::bulk;
295 STDEXEC_STD_DEPRECATED
296 inline constexpr auto split = stdexec::split;
297 STDEXEC_STD_DEPRECATED
298 inline constexpr auto when_all = stdexec::when_all;
299 STDEXEC_STD_DEPRECATED
300 inline constexpr auto when_all_with_variant = stdexec::when_all_with_variant;
301 STDEXEC_STD_DEPRECATED
302 inline constexpr auto transfer_when_all = stdexec::transfer_when_all;
303 STDEXEC_STD_DEPRECATED
304 inline constexpr auto transfer_when_all_with_variant =
305     stdexec::transfer_when_all_with_variant;
306 STDEXEC_STD_DEPRECATED
307 inline constexpr auto into_variant = stdexec::into_variant;
308 STDEXEC_STD_DEPRECATED
309 inline constexpr auto stopped_as_optional = stdexec::stopped_as_optional;
310 STDEXEC_STD_DEPRECATED
311 inline constexpr auto stopped_as_error = stdexec::stopped_as_error;
312 STDEXEC_STD_DEPRECATED
313 inline constexpr auto ensure_started = stdexec::ensure_started;
314 
315 // [exec.consumers], sender consumers
316 using start_detached_t STDEXEC_STD_DEPRECATED = stdexec::start_detached_t;
317 STDEXEC_STD_DEPRECATED
318 inline constexpr auto start_detached = stdexec::start_detached;
319 
320 // [exec.utils], sender and receiver utilities
321 // [exec.utils.rcvr_adptr]
322 template <class _Derived, class _Base = stdexec::__adaptors::__not_a_receiver>
323 using receiver_adaptor STDEXEC_STD_DEPRECATED =
324     stdexec::receiver_adaptor<_Derived, _Base>;
325 
326 // [exec.utils.cmplsigs]
327 template <class... _Sigs>
328 using completion_signatures STDEXEC_STD_DEPRECATED =
329     stdexec::completion_signatures<_Sigs...>;
330 
331 // [exec.utils.mkcmplsigs]
332 template <class _Sender, class _Env = stdexec::no_env,
333           class _Sigs = stdexec::completion_signatures<>,
334           template <class...>
335           class _SetValue = stdexec::__compl_sigs::__default_set_value,
336           template <class>
337           class _SetError = stdexec::__compl_sigs::__default_set_error,
338           class _SetStopped =
339               stdexec::completion_signatures<stdexec::set_stopped_t()>>
340 using make_completion_signatures STDEXEC_STD_DEPRECATED =
341     stdexec::make_completion_signatures<_Sender, _Env, _Sigs, _SetValue,
342                                         _SetError, _SetStopped>;
343 
344 // [exec.ctx], execution contexts
345 using run_loop STDEXEC_STD_DEPRECATED = stdexec::run_loop;
346 
347 // [exec.execute], execute
348 using execute_t STDEXEC_STD_DEPRECATED = stdexec::execute_t;
349 STDEXEC_STD_DEPRECATED
350 inline constexpr auto execute = stdexec::execute;
351 
352 #if !_STD_NO_COROUTINES_
353 // [exec.as_awaitable]
354 using as_awaitable_t STDEXEC_STD_DEPRECATED = stdexec::as_awaitable_t;
355 STDEXEC_STD_DEPRECATED
356 inline constexpr auto as_awaitable = stdexec::as_awaitable;
357 
358 // [exec.with_awaitable_senders]
359 template <class _Promise>
360 using with_awaitable_senders STDEXEC_STD_DEPRECATED =
361     stdexec::with_awaitable_senders<_Promise>;
362 #endif // !_STD_NO_COROUTINES_
363 } // namespace execution
364 
365 namespace this_thread
366 {
367 using execute_may_block_caller_t STDEXEC_STD_DEPRECATED =
368     stdexec::execute_may_block_caller_t;
369 using sync_wait_t STDEXEC_STD_DEPRECATED = stdexec::sync_wait_t;
370 using sync_wait_with_variant_t STDEXEC_STD_DEPRECATED =
371     stdexec::sync_wait_with_variant_t;
372 
373 STDEXEC_STD_DEPRECATED
374 inline constexpr auto execute_may_block_caller =
375     stdexec::execute_may_block_caller;
376 STDEXEC_STD_DEPRECATED
377 inline constexpr auto sync_wait = stdexec::sync_wait;
378 STDEXEC_STD_DEPRECATED
379 inline constexpr auto sync_wait_with_variant = stdexec::sync_wait_with_variant;
380 } // namespace this_thread
381 } // namespace std
382