cuda::experimental::stf::sump::returned#

template<class _S = void, class _X>
auto cuda::experimental::stf::sump::returned(
_X &&__x
)#

The code channel, as a selector or as a conversion.

Given a policy, returned(p) applies p to failing statuses only, and an exception passes through it; see thrown.

Given a function, returned<S>(f) converts: for a failing status of type S, the answer is f(s); statuses of other types and exceptions forward. The answer follows the same protocol as everywhere: a value of type S substitutes, void is Nothing, nullval never returns, and a throw from f turns the status into that exception:

returned<cudaError_t>([](cudaError_t s) -> cudaError_t { throw std::runtime_error(cudaGetErrorName(s)); })

Parameters:

__x – [in] The policy, or the function taking an S.

Returns:

The selector or converter policy.