:relfileprefix: ../../ [#4932706B459CBD080D4A150B001FBDBC789C9024] = Class exception_checker pass:v,q[A predicate for checking whether an exception is being thrown.] == Synopsis Declared in header `` [source,cpp,subs="verbatim,macros,-callouts"] ---- class exception_checker; ---- == Types [,cols=2] |=== |Name |Description |xref:boost/scope/exception_checker/result_type.adoc[`pass:v[result_type]`] | pass:v,q[Predicate result type] |=== == Member Functions [,cols=2] |=== |Name |Description |xref:boost/scope/exception_checker/2constructor.adoc[`pass:v[exception_checker]`] | pass:v,q[Constructs the predicate.] |xref:boost/scope/exception_checker/operator_call.adoc[`pass:v[operator()]`] | pass:v,q[Checks if an exception is being thrown.] |=== == Description pass:v,q[On construction, the predicate captures the current number of uncaught exceptions,] pass:v,q[which it then compares with the number of uncaught exceptions at the point when it] pass:v,q[is called. If the number increased then a new exception is detected and the predicate] pass:v,q[returns] `true.` [NOTE] pass:v,q[This predicate is designed for a specific use case with scope guards created on] pass:v,q[the stack. It is incompatible with C++20 coroutines and similar facilities (e.g.] pass:v,q[fibers and userspace context switching), where the thread of execution may be] pass:v,q[suspended after the predicate captures the number of uncaught exceptions and] pass:v,q[then resumed in a different context, where the number of uncaught exceptions] pass:v,q[has changed. Similarly, it is incompatible with usage patterns where the predicate] pass:v,q[is cached after construction and is invoked after the thread has left the scope] pass:v,q[where the predicate was constructed (e.g. when the predicate is stored as a class] pass:v,q[data member or a namespace-scope variable).]