I'm looking at the reference implementation of P2300 (the senders and receivers proposal).
I'm having trouble understanding some of the code:
namespace __compl_sigs {
template <same_as<set_value_t> _Tag, class _Ty = __q<__types>, class... _Args>
__types<__minvoke<_Ty, _Args...>> __test(_Tag (*)(_Args...));
template <same_as<set_error_t> _Tag, class _Ty = __q<__types>, class _Error>
__types<__minvoke<_Ty, _Error>> __test(_Tag (*)(_Error));
template <same_as<set_stopped_t> _Tag, class _Ty = __q<__types>>
__types<__minvoke<_Ty>> __test(_Tag (*)());
template <class, class = void>
__types<> __test(...);
template <class _Tag, class _Ty = void, class... _Args>
void __test(_Tag (*)(_Args...) noexcept) = delete;
template <class _Sig>
concept __completion_signature = __typename<decltype(__compl_sigs::__test((_Sig*) nullptr))>;
} // namespace __compl_sigs
using __compl_sigs::__completion_signature;
// [...]
template <__compl_sigs::__completion_signature... _Sigs>
struct completion_signatures {
// Uncomment this to see where completion_signatures is
// erroneously getting instantiated:
//static_assert(sizeof...(_Sigs) == -1u);
};
Fundamentally, can someone give me an example for a sender and what __types<__minvoke<_Ty, _Args...>>
, __types<__minvoke<_Ty, _Error>>
and __types<__minvoke<_Ty>>
actually mean? I understand that they relate to set_value
, set_error
and set_stopped
.
Finally, what is the use for completion_signatures
?