folly::rich_exception_ptr

rich_exception_ptr is an analog of exception_wrapper or std::exception_ptr, with some extra efficiency optimizations, and integration with rich_error / epitaph. It was designed to support rich-error features in result.h.

Synopsis

Declared in <folly/result/rich_exception_ptr.h>

class [[nodiscard]] rich_exception_ptr final
    : public /* implementation-defined */

Description

This class typically owns a std::exception_ptr, or stores a cheap-to-copy pointer to an immortal exception. Unlike exception_wrapper, it enables RTTI-free lookup for rich_error_base & result<T>::has_stopped().

However, private APIs can store some other states in its internal union. For this reason, rich_exception_ptr should not be used in most end-user code. Instead, use error_or_stopped.

While generally aligned to exception_wrapper, this API is much smaller. Notably, the ONLY way to test rich_exception_ptr for the presence of the exception type Ex is via folly::get_exception<Ex>(rich_eptr).

Base Classes

NameDescription
/* implementation-defined */

Member Functions

NameDescription
format_to Formats the exception into a fmt output iterator.

Return Value

NOTE

The return value should not be discarded.