3rdParty/boost/1.78.0/libs/exception/doc/error_info.html
#include <boost/exception/info.hpp>
namespace
boost
{ template \<class Tag,class T\> class error\_info { public: typedef T [value\_type](error_info_value_type.html); [error\_info](error_info_error_info.html)( [value\_type](error_info_value_type.html) const & v ); [value\_type](error_info_value_type.html) const & [value](error_info_value.html)() const; [value\_type](error_info_value_type.html) & [value](error_info_value.html)(); };}
T must have accessible copy constructor and must not be a reference (there is no requirement that T's copy constructor does not throw.)
This class template is used to associate a Tag type with a value type T. Objects of type error_info<Tag,T> can be passed to operator<< to be stored in objects of type boost::exception.
The header <boost/exception/error_info.hpp> provides a declaration of the error_info template, which is sufficient for the purpose of typedefing an instance for specific Tag and T, for example:
#include <[boost/exception/error\_info.hpp](boost_exception_error_info_hpp.html)>
struct tag_errno;
typedef boost::error\_info<tag_errno,int> errno_info;
Or, the shorter equivalent:
#include <[boost/exception/error\_info.hpp](boost_exception_error_info_hpp.html)>
typedef boost::error\_info<struct tag_errno,int> errno_info;
This errno_info typedef can be passed to operator<< (#include <boost/exception/info.hpp> first) to store an int named tag_errno in exceptions of types that derive from boost::exception:
throw file_read_error()[\<\<](exception_operator_shl.html)errno_info(errno);
It can also be passed to get_error_info (#include <boost/exception/get_error_info.hpp> first) to retrieve the tag_errno int from a boost::exception:
catch( boost::[exception](exception.html)& x )
{
if( int const * e=boost::[get\_error\_info](get_error_info.html)<errno_info>(x) )
....
}
For convenience and uniformity, Boost Exception defines the following commonly used error_info typedefs, ready for use with operator<<:
errinfo_api_function
errinfo_at_line
errinfo_errno
errinfo_file_handle
errinfo_file_name
errinfo_file_open_mode
errinfo_nested_exception
errinfo_type_info_name
See also: Boost Exception | boost/exception/error_info.hpp | boost/exception/exception.hpp | boost/exception/info.hpp | diagnostic_information | diagnostic_information_what | error_info::error_info | error_info::value | error_info::value_type | exception | exception/operator<< | exception_ptr | Frequently Asked Questions | get_error_info | Integrating Boost Exception in Existing Exception Class Hierarchies | Motivation | original_exception_type | tuple/operator<<
Copyright (c) 2006-2009 by Emil Dotchevski and Reverge Studios, Inc.
Distributed under the Boost Software License, Version 1.0.