1*5cee9157SPatrick Williams /*
2*5cee9157SPatrick Williams  * Copyright (c) 2021-2024 NVIDIA Corporation
3*5cee9157SPatrick Williams  *
4*5cee9157SPatrick Williams  * Licensed under the Apache License Version 2.0 with LLVM Exceptions
5*5cee9157SPatrick Williams  * (the "License"); you may not use this file except in compliance with
6*5cee9157SPatrick Williams  * the License. You may obtain a copy of the License at
7*5cee9157SPatrick Williams  *
8*5cee9157SPatrick Williams  *   https://llvm.org/LICENSE.txt
9*5cee9157SPatrick Williams  *
10*5cee9157SPatrick Williams  * Unless required by applicable law or agreed to in writing, software
11*5cee9157SPatrick Williams  * distributed under the License is distributed on an "AS IS" BASIS,
12*5cee9157SPatrick Williams  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13*5cee9157SPatrick Williams  * See the License for the specific language governing permissions and
14*5cee9157SPatrick Williams  * limitations under the License.
15*5cee9157SPatrick Williams  */
16*5cee9157SPatrick Williams #pragma once
17*5cee9157SPatrick Williams 
18*5cee9157SPatrick Williams #include "__execution_fwd.hpp"
19*5cee9157SPatrick Williams 
20*5cee9157SPatrick Williams // include these after __execution_fwd.hpp
21*5cee9157SPatrick Williams #include "__concepts.hpp"
22*5cee9157SPatrick Williams #include "__diagnostics.hpp"
23*5cee9157SPatrick Williams #include "__meta.hpp"
24*5cee9157SPatrick Williams 
25*5cee9157SPatrick Williams namespace stdexec
26*5cee9157SPatrick Williams {
27*5cee9157SPatrick Williams /////////////////////////////////////////////////////////////////////////////
28*5cee9157SPatrick Williams // completion_signatures
29*5cee9157SPatrick Williams namespace __sigs
30*5cee9157SPatrick Williams {
31*5cee9157SPatrick Williams template <class... _Args>
32*5cee9157SPatrick Williams inline constexpr bool __is_compl_sig<set_value_t(_Args...)> = true;
33*5cee9157SPatrick Williams template <class _Error>
34*5cee9157SPatrick Williams inline constexpr bool __is_compl_sig<set_error_t(_Error)> = true;
35*5cee9157SPatrick Williams template <>
36*5cee9157SPatrick Williams inline constexpr bool __is_compl_sig<set_stopped_t()> = true;
37*5cee9157SPatrick Williams 
38*5cee9157SPatrick Williams template <class>
39*5cee9157SPatrick Williams inline constexpr bool __is_completion_signatures = false;
40*5cee9157SPatrick Williams template <class... _Sigs>
41*5cee9157SPatrick Williams inline constexpr bool
42*5cee9157SPatrick Williams     __is_completion_signatures<completion_signatures<_Sigs...>> = true;
43*5cee9157SPatrick Williams } // namespace __sigs
44*5cee9157SPatrick Williams 
45*5cee9157SPatrick Williams template <class... _Sigs>
46*5cee9157SPatrick Williams struct completion_signatures
47*5cee9157SPatrick Williams {};
48*5cee9157SPatrick Williams 
49*5cee9157SPatrick Williams template <class _Completions>
50*5cee9157SPatrick Williams concept __valid_completion_signatures = //
51*5cee9157SPatrick Williams     __same_as<__ok_t<_Completions>, __msuccess> &&
52*5cee9157SPatrick Williams     __sigs::__is_completion_signatures<_Completions>;
53*5cee9157SPatrick Williams 
54*5cee9157SPatrick Williams template <class _Sender, class _Env>
55*5cee9157SPatrick Williams using __unrecognized_sender_error = //
56*5cee9157SPatrick Williams     __mexception<_UNRECOGNIZED_SENDER_TYPE_<>, _WITH_SENDER_<_Sender>,
57*5cee9157SPatrick Williams                  _WITH_ENVIRONMENT_<_Env>>;
58*5cee9157SPatrick Williams } // namespace stdexec
59