1 /*
2  * Copyright (c) 2021-2024 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 #include "__execution_fwd.hpp"
19 
20 // include these after __execution_fwd.hpp
21 #include "__concepts.hpp"
22 #include "__diagnostics.hpp"
23 #include "__meta.hpp"
24 
25 namespace stdexec
26 {
27 /////////////////////////////////////////////////////////////////////////////
28 // completion_signatures
29 namespace __sigs
30 {
31 template <class... _Args>
32 inline constexpr bool __is_compl_sig<set_value_t(_Args...)> = true;
33 template <class _Error>
34 inline constexpr bool __is_compl_sig<set_error_t(_Error)> = true;
35 template <>
36 inline constexpr bool __is_compl_sig<set_stopped_t()> = true;
37 
38 template <class>
39 inline constexpr bool __is_completion_signatures = false;
40 template <class... _Sigs>
41 inline constexpr bool
42     __is_completion_signatures<completion_signatures<_Sigs...>> = true;
43 } // namespace __sigs
44 
45 template <class... _Sigs>
46 struct completion_signatures
47 {};
48 
49 template <class _Completions>
50 concept __valid_completion_signatures = //
51     __same_as<__ok_t<_Completions>, __msuccess> &&
52     __sigs::__is_completion_signatures<_Completions>;
53 
54 template <class _Sender, class _Env>
55 using __unrecognized_sender_error = //
56     __mexception<_UNRECOGNIZED_SENDER_TYPE_<>, _WITH_SENDER_<_Sender>,
57                  _WITH_ENVIRONMENT_<_Env>>;
58 } // namespace stdexec
59