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 STDEXEC_STD_DEPRECATED
123 inline constexpr stdexec::get_forward_progress_guarantee_t
124     get_forward_progress_guarantee{};
125 
126 // [exec.recv], receivers
127 template <class _Receiver>
128 concept receiver /*STDEXEC_STD_DEPRECATED*/ = stdexec::receiver<_Receiver>;
129 
130 template <class _Receiver, class _Completions>
131 concept receiver_of /*STDEXEC_STD_DEPRECATED*/ =
132     stdexec::receiver_of<_Receiver, _Completions>;
133 
134 using set_value_t STDEXEC_STD_DEPRECATED = stdexec::set_value_t;
135 using set_error_t STDEXEC_STD_DEPRECATED = stdexec::set_error_t;
136 using set_stopped_t STDEXEC_STD_DEPRECATED = stdexec::set_stopped_t;
137 STDEXEC_STD_DEPRECATED
138 inline constexpr stdexec::set_value_t set_value{};
139 STDEXEC_STD_DEPRECATED
140 inline constexpr stdexec::set_error_t set_error{};
141 STDEXEC_STD_DEPRECATED
142 inline constexpr stdexec::set_stopped_t set_stopped{};
143 
144 // [exec.recv_queries], receiver queries
145 // using stdexec::forwarding_receiver_query_t; // BUGBUG
146 // using stdexec::forwarding_receiver_query; // BUGBUG
147 
148 // [exec.op_state], operation states
149 template <class _OpState>
150 concept operation_state /*STDEXEC_STD_DEPRECATED*/ =
151     stdexec::operation_state<_OpState>;
152 
153 using start_t STDEXEC_STD_DEPRECATED = stdexec::start_t;
154 STDEXEC_STD_DEPRECATED
155 inline constexpr stdexec::start_t start{};
156 
157 // [exec.snd], senders
158 template <class _Sender, class _Env = stdexec::no_env>
159 concept sender /*STDEXEC_STD_DEPRECATED*/ = stdexec::sender_in<_Sender, _Env>;
160 
161 template <class _Sender, class _Receiver>
162 concept sender_to /*STDEXEC_STD_DEPRECATED*/ =
163     stdexec::sender_to<_Sender, _Receiver>;
164 
165 template <class _Sender, class _SetSig, class _Env = stdexec::no_env>
166 concept sender_of /*STDEXEC_STD_DEPRECATED*/ =
167     stdexec::sender_of<_Sender, _SetSig, _Env>;
168 
169 // [exec.sndtraits], completion signatures
170 using get_completion_signatures_t STDEXEC_STD_DEPRECATED =
171     stdexec::get_completion_signatures_t;
172 STDEXEC_STD_DEPRECATED
173 inline constexpr stdexec::get_completion_signatures_t
174     get_completion_signatures{};
175 
176 template <class _Sender, class _Env = stdexec::no_env>
177 using completion_signatures_of_t STDEXEC_STD_DEPRECATED =
178     stdexec::completion_signatures_of_t<_Sender, _Env>;
179 
180 template <class _Env>
181 using dependent_completion_signatures STDEXEC_STD_DEPRECATED =
182     stdexec::dependent_completion_signatures<_Env>;
183 
184 template <                                                       //
185     class _Sender,                                               //
186     class _Env = stdexec::no_env,                                //
187     template <class...> class _Tuple = stdexec::__decayed_tuple, //
188     template <class...> class _Variant = stdexec::__variant>
189 using value_types_of_t STDEXEC_STD_DEPRECATED =
190     stdexec::value_types_of_t<_Sender, _Env, _Tuple, _Variant>;
191 
192 template <                        //
193     class _Sender,                //
194     class _Env = stdexec::no_env, //
195     template <class...> class _Variant = stdexec::__variant>
196 using error_types_of_t STDEXEC_STD_DEPRECATED =
197     stdexec::error_types_of_t<_Sender, _Env, _Variant>;
198 
199 template <class _Sender, class _Env = stdexec::no_env>
200 STDEXEC_STD_DEPRECATED inline constexpr bool sends_stopped =
201     stdexec::sends_stopped<_Sender, _Env>;
202 
203 // [exec.connect], the connect sender algorithm
204 using connect_t STDEXEC_STD_DEPRECATED = stdexec::connect_t;
205 STDEXEC_STD_DEPRECATED
206 inline constexpr stdexec::connect_t connect{};
207 
208 template <class _Sender, class _Receiver>
209 using connect_result_t STDEXEC_STD_DEPRECATED =
210     stdexec::connect_result_t<_Sender, _Receiver>;
211 
212 template <class _Tag>
213 using get_completion_scheduler_t STDEXEC_STD_DEPRECATED =
214     stdexec::get_completion_scheduler_t<_Tag>;
215 
216 template <class _Tag>
217 STDEXEC_STD_DEPRECATED inline constexpr stdexec::get_completion_scheduler_t<
218     _Tag>
219     get_completion_scheduler{};
220 
221 // [exec.factories], sender factories
222 using schedule_t STDEXEC_STD_DEPRECATED = stdexec::schedule_t;
223 using transfer_just_t STDEXEC_STD_DEPRECATED = stdexec::transfer_just_t;
224 STDEXEC_STD_DEPRECATED
225 inline constexpr auto just = stdexec::just;
226 STDEXEC_STD_DEPRECATED
227 inline constexpr auto just_error = stdexec::just_error;
228 STDEXEC_STD_DEPRECATED
229 inline constexpr auto just_stopped = stdexec::just_stopped;
230 STDEXEC_STD_DEPRECATED
231 inline constexpr auto schedule = stdexec::schedule;
232 STDEXEC_STD_DEPRECATED
233 inline constexpr auto transfer_just = stdexec::transfer_just;
234 STDEXEC_STD_DEPRECATED
235 inline constexpr auto read = stdexec::read;
236 
237 template <class _Scheduler>
238 using schedule_result_t STDEXEC_STD_DEPRECATED =
239     stdexec::schedule_result_t<_Scheduler>;
240 
241 // [exec.adapt], sender adaptors
242 template <class _Closure>
243 using sender_adaptor_closure STDEXEC_STD_DEPRECATED =
244     stdexec::sender_adaptor_closure<_Closure>;
245 
246 using on_t STDEXEC_STD_DEPRECATED = stdexec::on_t;
247 using transfer_t STDEXEC_STD_DEPRECATED = stdexec::transfer_t;
248 using schedule_from_t STDEXEC_STD_DEPRECATED = stdexec::schedule_from_t;
249 using then_t STDEXEC_STD_DEPRECATED = stdexec::then_t;
250 using upon_error_t STDEXEC_STD_DEPRECATED = stdexec::upon_error_t;
251 using upon_stopped_t STDEXEC_STD_DEPRECATED = stdexec::upon_stopped_t;
252 using let_value_t STDEXEC_STD_DEPRECATED = stdexec::let_value_t;
253 using let_error_t STDEXEC_STD_DEPRECATED = stdexec::let_error_t;
254 using let_stopped_t STDEXEC_STD_DEPRECATED = stdexec::let_stopped_t;
255 using bulk_t STDEXEC_STD_DEPRECATED = stdexec::bulk_t;
256 using split_t STDEXEC_STD_DEPRECATED = stdexec::split_t;
257 using when_all_t STDEXEC_STD_DEPRECATED = stdexec::when_all_t;
258 using when_all_with_variant_t STDEXEC_STD_DEPRECATED =
259     stdexec::when_all_with_variant_t;
260 using transfer_when_all_t STDEXEC_STD_DEPRECATED = stdexec::transfer_when_all_t;
261 using transfer_when_all_with_variant_t STDEXEC_STD_DEPRECATED =
262     stdexec::transfer_when_all_with_variant_t;
263 using into_variant_t STDEXEC_STD_DEPRECATED = stdexec::into_variant_t;
264 using stopped_as_optional_t STDEXEC_STD_DEPRECATED =
265     stdexec::stopped_as_optional_t;
266 using stopped_as_error_t STDEXEC_STD_DEPRECATED = stdexec::stopped_as_error_t;
267 using ensure_started_t STDEXEC_STD_DEPRECATED = stdexec::ensure_started_t;
268 
269 STDEXEC_STD_DEPRECATED
270 inline constexpr auto on = stdexec::on;
271 STDEXEC_STD_DEPRECATED
272 inline constexpr auto transfer = stdexec::transfer;
273 STDEXEC_STD_DEPRECATED
274 inline constexpr auto schedule_from = stdexec::schedule_from;
275 STDEXEC_STD_DEPRECATED
276 inline constexpr auto then = stdexec::then;
277 STDEXEC_STD_DEPRECATED
278 inline constexpr auto upon_error = stdexec::upon_error;
279 STDEXEC_STD_DEPRECATED
280 inline constexpr auto upon_stopped = stdexec::upon_stopped;
281 STDEXEC_STD_DEPRECATED
282 inline constexpr auto let_value = stdexec::let_value;
283 STDEXEC_STD_DEPRECATED
284 inline constexpr auto let_error = stdexec::let_error;
285 STDEXEC_STD_DEPRECATED
286 inline constexpr auto let_stopped = stdexec::let_stopped;
287 STDEXEC_STD_DEPRECATED
288 inline constexpr auto bulk = stdexec::bulk;
289 STDEXEC_STD_DEPRECATED
290 inline constexpr auto split = stdexec::split;
291 STDEXEC_STD_DEPRECATED
292 inline constexpr auto when_all = stdexec::when_all;
293 STDEXEC_STD_DEPRECATED
294 inline constexpr auto when_all_with_variant = stdexec::when_all_with_variant;
295 STDEXEC_STD_DEPRECATED
296 inline constexpr auto transfer_when_all = stdexec::transfer_when_all;
297 STDEXEC_STD_DEPRECATED
298 inline constexpr auto transfer_when_all_with_variant =
299     stdexec::transfer_when_all_with_variant;
300 STDEXEC_STD_DEPRECATED
301 inline constexpr auto into_variant = stdexec::into_variant;
302 STDEXEC_STD_DEPRECATED
303 inline constexpr auto stopped_as_optional = stdexec::stopped_as_optional;
304 STDEXEC_STD_DEPRECATED
305 inline constexpr auto stopped_as_error = stdexec::stopped_as_error;
306 STDEXEC_STD_DEPRECATED
307 inline constexpr auto ensure_started = stdexec::ensure_started;
308 
309 // [exec.consumers], sender consumers
310 using start_detached_t STDEXEC_STD_DEPRECATED = stdexec::start_detached_t;
311 STDEXEC_STD_DEPRECATED
312 inline constexpr auto start_detached = stdexec::start_detached;
313 
314 // [exec.utils], sender and receiver utilities
315 // [exec.utils.rcvr_adptr]
316 template <class _Derived, class _Base = stdexec::__adaptors::__not_a_receiver>
317 using receiver_adaptor STDEXEC_STD_DEPRECATED =
318     stdexec::receiver_adaptor<_Derived, _Base>;
319 
320 // [exec.utils.cmplsigs]
321 template <class... _Sigs>
322 using completion_signatures STDEXEC_STD_DEPRECATED =
323     stdexec::completion_signatures<_Sigs...>;
324 
325 // [exec.utils.mkcmplsigs]
326 template <                                                        //
327     class _Sender,                                                //
328     class _Env = stdexec::no_env,
329     class _Sigs = stdexec::completion_signatures<>,               //
330     template <class...>
331     class _SetValue = stdexec::__compl_sigs::__default_set_value, //
332     template <class>
333     class _SetError = stdexec::__compl_sigs::__default_set_error, //
334     class _SetStopped =
335         stdexec::completion_signatures<stdexec::set_stopped_t()>>
336 using make_completion_signatures STDEXEC_STD_DEPRECATED =
337     stdexec::make_completion_signatures<_Sender, _Env, _Sigs, _SetValue,
338                                         _SetError, _SetStopped>;
339 
340 // [exec.ctx], execution contexts
341 using run_loop STDEXEC_STD_DEPRECATED = stdexec::run_loop;
342 
343 // [exec.execute], execute
344 using execute_t STDEXEC_STD_DEPRECATED = stdexec::execute_t;
345 STDEXEC_STD_DEPRECATED
346 inline constexpr auto execute = stdexec::execute;
347 
348 #if !STDEXEC_STD_NO_COROUTINES_
349 // [exec.as_awaitable]
350 using as_awaitable_t STDEXEC_STD_DEPRECATED = stdexec::as_awaitable_t;
351 STDEXEC_STD_DEPRECATED
352 inline constexpr auto as_awaitable = stdexec::as_awaitable;
353 
354 // [exec.with_awaitable_senders]
355 template <class _Promise>
356 using with_awaitable_senders STDEXEC_STD_DEPRECATED =
357     stdexec::with_awaitable_senders<_Promise>;
358 #endif // !STDEXEC_STD_NO_COROUTINES_
359 } // namespace execution
360 
361 namespace this_thread
362 {
363 using execute_may_block_caller_t STDEXEC_STD_DEPRECATED =
364     stdexec::execute_may_block_caller_t;
365 using sync_wait_t STDEXEC_STD_DEPRECATED = stdexec::sync_wait_t;
366 using sync_wait_with_variant_t STDEXEC_STD_DEPRECATED =
367     stdexec::sync_wait_with_variant_t;
368 
369 STDEXEC_STD_DEPRECATED
370 inline constexpr auto execute_may_block_caller =
371     stdexec::execute_may_block_caller;
372 STDEXEC_STD_DEPRECATED
373 inline constexpr auto sync_wait = stdexec::sync_wait;
374 STDEXEC_STD_DEPRECATED
375 inline constexpr auto sync_wait_with_variant = stdexec::sync_wait_with_variant;
376 } // namespace this_thread
377 } // namespace std
378