cuda::experimental::stf::sump::when#
-
template<class _Pred>
struct when# Predicate guard:
when(pred)(s)restricts the sinksto the cases wherepredholds.when(pred)is itself a sink, the guard; applying it to a sinksyieldswhen(pred) & s. There is no runtime “nop” answer on the exception path: a hook either accepts or forwards. A true predicate contributes a void effect answer so&continues; false forwards by throwing. As a|arm this means “not applicable, try the next arm”; inside&, false passes the whole sequence through. The predicate takes either nothing or theconst std::exception*of the failure in flight. A guard can be named and applied to several sinks:auto transient = when(is_transient); transient(retry(3)) | transient(notify(log)). The guard holds the predicate by value: an lvalue predicate is copied, so later changes to the original do not reach the guard; passstd::ref(pred)to share one predicate object. Each application copies the predicate into the guarded sink.if_isaremains separate because its typed claims support the starved-arm theorem, while arbitrary predicates do not.Public Functions
-
template<class _P>
inline auto operator()(_P &&__p) const &# Applies the guard to a sink:
when(pred)(s)iswhen(pred) & s.
-
template<class _Fn>
inline void on_thrown( - const ::std::exception *__exception,
- const ::cuda::std::source_location,
- _Fn&
-
template<class _Status, class _Fn, class _Self = _Pred, ::cuda::std::enable_if_t<::cuda::std::is_invocable_v<_Self&>, int> = 0>
inline detail::__status_answer<_Status> on_returned(
)# The code-channel hook for a nullary predicate: true contributes an effect, false passes the status through.
A predicate over
const std::exception*receives the status’s exception instead.
-
template<class _P>