cuda::experimental::stf::exception_policies::catch_exactly#

template<class ..._Es, class _P>
auto cuda::experimental::stf::exception_policies::catch_exactly(
_P &&__p
)#

Restricts a policy to exceptions whose dynamic type is exactly one of E1, E2, ...: monomorphic where catch_only is polymorphic, so a handler accepts a type without inheriting its cone.

catch_exactly<std::bad_alloc>(p) handles allocation pressure yet lets std::bad_array_new_length, a size-computation bug, fly on; value operations that would slice under a cone (copy, store) are safe behind an exact gate; and the guard’s contract cannot drift when someone derives a new type later. Matching reads the dynamic type through the std::exception funnel, so every listed type must derive std::exception, and a non-std active exception always declines. Duplicates are rejected; Base and Derived may both be listed, each matching only itself. In | chains, catch_exactly<E>(recover) | catch_only<E>(fallback) layers the exact type against the rest of its cone; the reverse order starves the exact arm and is a compile error.