cuda::experimental::stf::sump::subst_t#

template<class _V>
struct subst_t#

Value-substitution policy; subst(v) is the documented spelling for what a bare value passed to sump::sink also means.

The exception hook answers, in order: the result of invoking the stored value as a handler (const std::exception*, source_location, Fn&) when that is well-formed (so subst([](const std::exception* e, auto, auto&){ ... }) reacts to the exception; a handler stored in subst must not throw); else the result of invoking it as a nullary callable, a lazy fallback computed only on the exception path (subst([]{ return expensive(); })); else the stored value itself, forwarded out and owned if the policy owns it, referred to if it holds an lvalue reference (so a replacement passed as an lvalue can stand in for a reference result).

Public Functions

template<class _Fn>
inline decltype(auto) on_thrown(
const ::std::exception *__exception,
const ::cuda::std::source_location __loc,
_Fn &__fn
) noexcept#
template<class _Status, class _Fn, class _Self = _V, ::cuda::std::enable_if_t<!::cuda::std::is_invocable_v<_Self&, const ::std::exception*, ::cuda::std::source_location, _Fn&>, int> = 0>
inline decltype(auto) on_returned(
const _Status,
const ::cuda::std::source_location,
_Fn&
) noexcept#

The code-channel hook: answers the stored value, or the result of invoking a stored nullary callable.

The answer must be of the status type (subst(cudaSuccess), not subst(0)). A stored exception-aware handler receives the status’s exception instead.