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