DocWire SDK
DocWire SDK: Award-winning modern data processing in C++20. SourceForge Community Choice & Microsoft support. AI-driven processing. Supports nearly 100 data formats, including email boxes and OCR. Boost efficiency in text extraction, web data extraction, data mining, document analysis. Offline processing possible for security and confidentiality
docwire::errors::nested< T > Class Template Reference

A template class that simplifies the creation of nested exceptions. More...

#include <nested_exception.h>

Inheritance diagram for docwire::errors::nested< T >:

Public Member Functions

 nested (T &&t)
 Constructs a nested object from an rvalue reference to an object of type T. More...
 
 nested (const T &t)
 Constructs a nested object from a const lvalue reference to an object of type T. More...
 

Detailed Description

template<typename T>
class docwire::errors::nested< T >

A template class that simplifies the creation of nested exceptions.

In C++, creating a nested exception using std::nested_exception requires throwing and catching an inner exception, and then using std::throw_with_nested to create the nested exception. This template class, together with make_nested macro provides a more straightforward way to create nested exceptions without the need for throwing and catching.

Template Parameters
TThe type of the outer exception.
See also
make_nested
std::nested_exception

Definition at line 34 of file nested_exception.h.

Constructor & Destructor Documentation

◆ nested() [1/2]

template<typename T >
docwire::errors::nested< T >::nested ( T &&  t)
inline

Constructs a nested object from an rvalue reference to an object of type T.

Outer exception is constructed from the rvalue reference. Inner exception is captured using std::current_exception() and stored in the std::nested_exception base class.

Parameters
tAn rvalue reference to an object of type T.

Definition at line 46 of file nested_exception.h.

◆ nested() [2/2]

template<typename T >
docwire::errors::nested< T >::nested ( const T &  t)
inline

Constructs a nested object from a const lvalue reference to an object of type T.

Outer exception is constructed from the lvalue reference. exception is captured using std::current_exception() and stored in the std::nested_exception base class.

Parameters
tA const lvalue reference to an object of type T.

Definition at line 59 of file nested_exception.h.


The documentation for this class was generated from the following file: