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