diff --git a/doc/BOOST_THROW_EXCEPTION.html b/doc/BOOST_THROW_EXCEPTION.html index d56d97e..bf355d7 100644 --- a/doc/BOOST_THROW_EXCEPTION.html +++ b/doc/BOOST_THROW_EXCEPTION.html @@ -22,7 +22,7 @@

BOOST_THROW_EXCEPTION

#include <boost/throw_exception.hpp>

-
#if !defined( BOOST_NO_EXCEPTIONS ) && !defined( BOOST_EXCEPTION_DISABLE )
+
#if !defined( BOOST_EXCEPTION_DISABLE )
     #include <boost/exception/exception.hpp>
     #include <boost/current_function.hpp>
     #define BOOST_THROW_EXCEPTION(x)\
@@ -34,10 +34,13 @@
     #define BOOST_THROW_EXCEPTION(x) ::boost::throw_exception(x)
 #endif

This macro takes an exception object, records BOOST_CURRENT_FUNCTION, __FILE__ and __LINE__ in it, and forwards it to throw_exception. To recover this information at the catch site, use get_error_info; the information is also included in the message returned by diagnostic_information.

-
Boost Exception
+

+

See Also:

+
+
diff --git a/doc/boost-exception.html b/doc/boost-exception.html index 899e5f5..d2734c3 100644 --- a/doc/boost-exception.html +++ b/doc/boost-exception.html @@ -19,7 +19,7 @@ -

Introduction

+

Introduction

The purpose of Boost Exception is to ease the design of exception class hierarchies and to help write exception handling and error reporting code.

It supports transporting of arbitrary data to the catch site, which is otherwise tricky due to the no-throw requirements (15.5.1) for exception types. Data can be added to any exception object, either directly in the throw-expression (15.1), or at a later time as the exception object propagates up the call stack.

The ability to add data to exception objects after they have been passed to throw is important, because often some of the information needed to handle an exception is unavailable in the context where the failure is detected.

@@ -35,6 +35,10 @@
  • Documentation
    1. Class exception
    2. +
    3. Throwing Exceptions +
    4. Transporting of Arbitrary Data to the Catch Site
    5. -
    6. diagnostic_information
    7. -
    8. throw_exception, BOOST_THROW_EXCEPTION
    9. -
    10. Configuration Macros
    11. -
    12. Headers +
    13. +
    14. API
    15. Frequently Asked Questions
    16. -
    17. Index
    18. +
    19. Page Index
    -

    Synopsis

    -

    #include <boost/exception.hpp>

    -
    namespace
    -boost
    -    {
    -    class
    -    exception
    -        {
    -        protected:
    -    
    -        exception();
    -        exception( exception const & x );    
    -        ~exception();    
    -        };    
    -    
    -    template <class Tag,class T>
    -    class error_info;    
    -    
    -    typedef error_info<struct tag_throw_function,char const *> throw_function;
    -    typedef error_info<struct tag_throw_file,char const *> throw_file;
    -    typedef error_info<struct tag_throw_line,int> throw_line;
    -
    -    template <class Tag,class T>
    -    class
    -    error_info
    -        {
    -        public:
    -    
    -        typedef T value_type;    
    -    
    -        error_info( value_type const & v );    
    -        value_type const & value() const;    
    -        };    
    -    
    -    template <class E, class Tag, class T>
    -    E const & operator<<( E const & x, error_info<Tag,T> const & v );
    -
    -    template <class E, class Tag1, class T1, ..., class TagN, class TN>
    -    E const & operator<<( E const & x,
    -        tuple<
    -            error_info<Tag1,T1>,
    -            ...,
    -            error_info<TagN,TN> > const & v );
    -
    -    template <class T>
    -    ---unspecified--- enable_error_info( T const & x );
    -
    -    std::string diagnostic_information( boost::exception const & );
    -
    -    class
    -    unknown_exception:
    -        public std::exception
    -        public boost::exception
    -        {
    -        ---unspecified---
    -        };    
    -    
    -    typedef ---unspecified--- exception_ptr;    
    -    
    -    template <class T>
    -    exception_ptr copy_exception( T const & e );    
    -    
    -    exception_ptr current_exception();    
    -    
    -    void rethrow_exception( exception_ptr const & ep );
    -
    -    template <class T>
    -    ---unspecified--- enable_current_exception( T const & e );
    -    }
    -

    #include <boost/throw_exception.hpp>

    -
    #if !defined( BOOST_NO_EXCEPTIONS ) && !defined( BOOST_EXCEPTION_DISABLE )
    -    #include <boost/exception/exception.hpp>
    -    #include <boost/current_function.hpp>
    -    #define BOOST_THROW_EXCEPTION(x)\
    -        ::boost::throw_exception( ::boost::enable_error_info(x) <<\
    -        ::boost::throw_function(BOOST_CURRENT_FUNCTION) <<\
    -        ::boost::throw_file(__FILE__) <<\
    -        ::boost::throw_line((int)__LINE__) )
    -#else
    -    #define BOOST_THROW_EXCEPTION(x) ::boost::throw_exception(x)
    -#endif
    -
    -namespace
    -boost
    -    {
    -#ifdef BOOST_NO_EXCEPTIONS
    -    void throw_exception( std::exception const & e ); // user defined
    -#else
    -    template <class E>
    -    void throw_exception( E const & e );
    -#endif
    -    }
    -

    Class exception

    -

    exception

    -
    -

    #include <boost/exception/exception.hpp>

    -
    namespace
    -boost
    -    {
    -    class
    -    exception
    -        {
    -        protected:
    -    
    -        exception();
    -        exception( exception const & x );    
    -        ~exception();    
    -        };
    -    }
    -

    Class boost::exception is designed to be used as a universal base for user-defined exception types.

    -

    An object of any type deriving from boost::exception can store data of arbitrary types, using the error_info wrapper and operator<<.

    -

    To retrieve data from a boost::exception object, use the get_error_info function template.

    -

    Transporting of Arbitrary Data to the Catch Site

    -

    error_info

    -
    -

    #include <boost/exception/info.hpp>

    -
    namespace
    -boost
    -    {
    -    template <class Tag,class T>
    -    class
    -    error_info
    -        {
    -        public:
    -    
    -        typedef T value_type;    
    -    
    -        error_info( value_type const & v );    
    -        value_type const & value() const;    
    -        };
    -    }
    -

    Requirements:

    -

    T must have accessible copy constructor and must not be a reference (there is no requirement that T's copy constructor does not throw.)

    -

    Description:

    -

    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.

    -

    Usage:

    -

    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>
    -
    -struct tag_errno;
    -typedef boost::error_info<tag_errno,int> errno_info;
    -

    Or, the shorter equivalent:

    -
    #include <boost/exception/error_info.hpp>
    -
    -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() << 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 & x )
    -    {
    -    if( boost::shared_ptr<int const> e=boost::get_error_info<errno_info>(x) )
    -        ....
    -    }
    -

    exception/operator<<

    -
    -

    #include <boost/exception/info.hpp> 

    -
    namespace
    -boost
    -    {
    -    template <class E, class Tag, class T>
    -    E const & operator<<( E const & x, error_info<Tag,T> const & v );
    -    }
    -

    Requirements:

    -

    E must be boost::exception, or a type that derives (indirectly) from boost::exception.

    -

    Effects:

    -

    Stores a copy of v into x. If x already contains data of type error_info<Tag,T>, that data is overwritten.

    -

    Returns:

    -

    x.

    -

    Throws:

    -

    std::bad_alloc, or any exception emitted by the T copy constructor.

    -

    tuple/operator<<

    -
    -

    #include <boost/exception/info_tuple.hpp>

    -
    namespace
    -boost
    -    {
    -    template <class E, class Tag1, class T1, ..., class TagN, class TN>
    -    E const & operator<<( E const & x,
    -        tuple<
    -            error_info<Tag1,T1>,
    -            ...,
    -            error_info<TagN,TN> > const & v );
    -    }
    -

    Requirements:

    -

    E must be boost::exception, or a type that derives (indirectly) from boost::exception.

    -

    Effects:

    -

    Equivalent to x << v.get<0>() << ... << v.get<N>().

    -

    Returns:

    -

    x.

    -

    Throws:

    -

    std::bad_alloc, or any exception emitted by T1..TN copy constructor.

    -

    get_error_info

    -
    -

    #include <boost/exception/get_error_info.hpp>

    -
    namespace
    -boost
    -    {
    -    template <class ErrorInfo,class E>
    -    shared_ptr<typename ErrorInfo::value_type const> get_error_info( E const & x );
    -    }
    -

    Requirements:

    -
    • ErrorInfo must be an instance of the error_info template.
    • -
    • E must be polymorphic.
    • -
    • The get_error_info function must not be called outside of a catch block.
    • -
    -

    Returns:

    -
    • If dynamic_cast<boost::exception const *>(&x) is 0, or if x does not store an object of type ErrorInfo, the returned value is an empty shared_ptr.
    • -
    • Otherwise, the returned shared_ptr points to the stored value (use operator<< to store values in exception objects.) The shared_ptr is valid even after x has been destroyed.
    • -
    -

    Throws:

    -

    Nothing.

    -

    Note:

    -

    The interface of get_error_info may be affected by the build configuration macros.

    -

    enable_error_info

    -
    -

    #include <boost/exception/enable_error_info.hpp>

    -
    namespace
    -boost
    -    {
    -    template <class T>
    -    ---unspecified--- enable_error_info( T const & x );
    -    }
    -

    Requirements:

    -

    T must be a class with an accessible no-throw copy constructor as per (15.5.1).

    -

    Returns:

    -
    • If T derives from boost::exception, the returned object is of type T and is a copy of x.
    • -
    • Otherwise, the returned object is of an unspecified type that derives publicly from both T and boost::exception. The T sub-object is initialized from x by the T copy constructor.
    • -
    -

    Throws:

    -

    Nothing.

    -

    Transporting of Exceptions between Threads

    -

    exception_ptr

    -
    -

    #include <boost/exception_ptr.hpp>

    -
    namespace
    -boost
    -    {
    -    typedef ---unspecified--- exception_ptr;
    -    }
    -

    The exception_ptr type can be used to refer to a copy of an exception object. It is Default Constructible, Copy Constructible, Assignable and Equality Comparable; exception_ptr's operations do not throw.

    -

    Two instances of exception_ptr are equivalent and compare equal if and only if they refer to the same exception.

    -

    The default constructor of exception_ptr produces the null value of the type. The null value is equivalent only to itself.

    -

    Thread safety

    -
    • It is legal for multiple threads to hold exception_ptr references to the same exception object.
    • -
    • It is illegal for multiple threads to modify the same exception_ptr object concurrently.
    • -
    • While calling current_exception makes a copy of the current exception object, it is still possible for the two copies to share internal state. Therefore, in general it is not safe to call rethrow_exception concurrently to throw the same exception object into multiple threads.
    • -
    -

    enable_current_exception

    -
    -

    #include <boost/exception/enable_current_exception.hpp>

    -
    namespace
    -boost
    -    {
    -    template <class T>
    -    ---unspecified--- enable_current_exception( T const & e );
    -    }
    -

    Requirements:

    -

    T must be a class with an accessible no-throw copy constructor.

    -

    Returns:

    -

    An object of unspecified type which derives publicly from T. That is, the returned object can be intercepted by a catch(T &).

    -

    Description:

    -

    This function is designed to be used directly in a throw-expression to enable the exception_ptr support in Boost Exception. For example:

    -
    class
    -my_exception:
    -    public std::exception
    -    {
    -    };
    -
    -....
    -throw boost::enable_current_exception(my_exception());
    -

    Unless enable_current_exception is called at the time an exception object is used in a throw-expression, an attempt to copy it using current_exception may return an exception_ptr which refers to an instance of unknown_exception. See current_exception for details.

    -

    Note:

    -

    Instead of using the throw keyword directly, it is preferable to call boost::throw_exception. This is guaranteed to throw an exception that derives from boost::exception and supports the exception_ptr functionality.

    -

    current_exception

    -
    -

    #include <boost/exception_ptr.hpp>

    -
    namespace
    -boost
    -    {
    -    exception_ptr current_exception();
    -    }
    -

    Requirements:

    -

    The current_exception function must not be called outside of a catch block.

    -

    Returns:

    -
    • An exception_ptr that refers to the currently handled exception or a copy of the currently handled exception.
    • -
    • If the function needs to allocate memory and the attempt fails, it returns an exception_ptr that refers to an instance of std::bad_alloc.
    • -
    -

    Throws:

    -

    Nothing.

    -

    Notes:

    -
    -

    copy_exception

    -
    -

    #include <boost/exception_ptr.hpp>

    -
    namespace
    -boost
    -    {
    -    template <class T>
    -    exception_ptr copy_exception( T const & e );
    -    }
    -

    Effects:

    -

    As if

    -
    try
    -    {
    -    throw enable_current_exception(e);
    -    }
    -catch(...)
    -    {
    -    return current_exception();
    -    }
    -

    rethrow_exception

    -
    -

    #include <boost/exception_ptr.hpp>

    -
    namespace
    -boost
    -    {
    -    void rethrow_exception( exception_ptr const & ep );
    -    }
    -

    Precondition:

    -

    ep shall not be null.

    -

    Throws:

    -

    The exception to which ep refers.

    -

    unknown_exception

    -
    -

    #include <boost/exception_ptr.hpp>

    -
    namespace
    -boost
    -    {
    -    class
    -    unknown_exception:
    -        public std::exception
    -        public boost::exception
    -        {
    -        ---unspecified---
    -        };
    -    }
    -

    This type is used by the exception_ptr support in Boost Exception. Please see current_exception.

    -

    Printing Diagnostic Information

    -

    diagnostic_information

    -
    -

    #include <boost/exception/diagnostic_information.hpp> 

    -
    namespace
    -boost
    -    {
    -    std::string diagnostic_information( boost::exception const & );
    -    }
    -

    Returns:

    -

    This function returns a string value that is automatically composed from the string representations of all error_info objects stored in a boost::exception through operator<<, along with other diagnostic information relevant to the exception.

    -

    The string representation of each error_info object is deduced by a function call that is bound at the time the error_info<Tag,T> template is instantiated. The following overload resolutions are attempted in order:

    -
    1. Unqualified call to to_string(x), where x is of type error_info<Tag,T> (the return value is expected to be of type std::string.)
    2. -
    3. Unqualified call to to_string(x.value()) (the return value is expected to be of type std::string.)
    4. -
    5. Unqualified call to s << x.value(), where s is a std::ostringstream.
    6. -
    -

    The first successfully bound function is used at the time diagnostic_information is called; if all 3 overload resolutions are unsuccessful, the system is unable to convert the error_info object to string, and an unspecified stub string value is used without issuing a compile error.

    -

    Notes:

    -
    • The format of the returned string is unspecified.
    • -
    • The returned string is not user-friendly.
    • -
    • If dynamic_cast<std::exception const *>(&x) is not null, the returned string includes the output from std::exception::what.
    • -
    • The returned string may include additional platform-specific diagnostic information.
    • -
    -

    Example:

    -

    this is a possible output from the diagnostic_information function, as used in libs/exception/example/example_io.cpp:

    -
    libs\exception\example\example_io.cpp(83): Throw in function class boost::shared_ptr<struct _iobuf> __cdecl my_fopen(const char *,const char *)
    -Dynamic exception type: class boost::exception_detail::clone_impl<class fopen_error>
    -std::exception::what: example_io error
    -[struct tag_errno *] = 2, OS says "No such file or directory"
    -[struct tag_file_name *] = tmp1.txt
    -[struct tag_function *] = fopen
    -[struct tag_open_mode *] = rb
    -

    Throwing Exceptions

    -

    throw_exception

    -
    -

    #include <boost/throw_exception.hpp>

    -
    namespace
    -boost
    -    {
    -#ifdef BOOST_NO_EXCEPTIONS
    -    void throw_exception( std::exception const & e ); // user defined
    -#else
    -    template <class E>
    -    void throw_exception( E const & e );
    -#endif
    -    }
    -

    Requirements:

    -

    E must derive publicly from std::exception.

    -

    Effects:

    -
    • If BOOST_NO_EXCEPTIONS is not defined, boost::throw_exception(e) is equivalent to throw boost::enable_current_exception(boost::enable_error_info(e)), unless BOOST_EXCEPTION_DISABLE is defined, in which case boost::throw_exception(e) is equivalent to throw e;
    • -
    • If BOOST_NO_EXCEPTIONS is defined, the function is left undefined, and the user is expected to supply an appropriate definition. Callers of throw_exception are allowed to assume that the function never returns; therefore, if the user-defined throw_exception returns, the behavior is undefined.
    • -
    -

    BOOST_THROW_EXCEPTION

    -
    -

    #include <boost/throw_exception.hpp>

    -
    #if !defined( BOOST_NO_EXCEPTIONS ) && !defined( BOOST_EXCEPTION_DISABLE )
    -    #include <boost/exception/exception.hpp>
    -    #include <boost/current_function.hpp>
    -    #define BOOST_THROW_EXCEPTION(x)\
    -        ::boost::throw_exception( ::boost::enable_error_info(x) <<\
    -        ::boost::throw_function(BOOST_CURRENT_FUNCTION) <<\
    -        ::boost::throw_file(__FILE__) <<\
    -        ::boost::throw_line((int)__LINE__) )
    -#else
    -    #define BOOST_THROW_EXCEPTION(x) ::boost::throw_exception(x)
    -#endif
    -

    This macro takes an exception object, records BOOST_CURRENT_FUNCTION, __FILE__ and __LINE__ in it, and forwards it to throw_exception. To recover this information at the catch site, use get_error_info; the information is also included in the message returned by diagnostic_information.

    -

    Acknowledgements

    +

    Acknowledgements

    Peter Dimov has been continuously influencing the design and evolution of Boost Exception. Also thanks to Tobias Schwinger, Tom Brinkman, Pavel Vozenilek and everyone who participated in the review process.

    - +

  • See Also:

    -
    Boost Exception
    -
    enable_error_info
    +
    diff --git a/doc/exception_error_info_group_hpp.html b/doc/exception_error_info_group_hpp.html index 2b587d8..9c2d0d1 100644 --- a/doc/exception_error_info_group_hpp.html +++ b/doc/exception_error_info_group_hpp.html @@ -22,7 +22,8 @@

    boost/exception/info_tuple.hpp

    Synopsis

    -
    #include <boost/tuple/tuple.hpp>
    +
    #include <boost/exception/info.hpp>
    +#include <boost/tuple/tuple.hpp>
     
     namespace
     boost
    @@ -36,8 +37,8 @@ boost
         }

    See Also:

    - diff --git a/doc/exception_error_info_hpp.html b/doc/exception_error_info_hpp.html index 1277c5a..3d48ebc 100644 --- a/doc/exception_error_info_hpp.html +++ b/doc/exception_error_info_hpp.html @@ -23,8 +23,6 @@

    Synopsis

    #include <boost/exception/exception.hpp>
    -#include <boost/current_function.hpp>
    -#include <boost/shared_ptr.hpp>
     
     namespace
     boost
    @@ -46,13 +44,14 @@ boost
         }

    See Also:

    - diff --git a/doc/exception_error_info_value_hpp.html b/doc/exception_error_info_value_hpp.html index f91e244..bdf5c06 100644 --- a/doc/exception_error_info_value_hpp.html +++ b/doc/exception_error_info_value_hpp.html @@ -30,9 +30,9 @@ boost }

    See Also:

    -
    Boost Exception
    -
    boost/exception.hpp
    +
    diff --git a/doc/exception_exception_hpp.html b/doc/exception_exception_hpp.html index 0c60895..ff73ba2 100644 --- a/doc/exception_exception_hpp.html +++ b/doc/exception_exception_hpp.html @@ -45,13 +45,13 @@ boost

    See Also:

    BOOST_THROW_EXCEPTION
    -
    Boost Exception
    boost/exception.hpp
    boost/exception/enable_current_exception.hpp
    boost/exception/enable_error_info.hpp
    boost/exception/info.hpp
    boost/exception_ptr.hpp
    exception
    +
    Synopsis
    diff --git a/doc/exception_get_error_info_hpp.html b/doc/exception_get_error_info_hpp.html index dcb39d8..727c7c5 100644 --- a/doc/exception_get_error_info_hpp.html +++ b/doc/exception_get_error_info_hpp.html @@ -28,14 +28,12 @@ namespace boost { template <class ErrorInfo,class E> - shared_ptr<typename ErrorInfo::value_type const> get_error_info( E const & x ); + typename ErrorInfo::value_type const * get_error_info( E const & x ); }

    See Also:

    -
    Boost Exception
    -
    boost/exception.hpp
    +
    diff --git a/doc/exception_hpp.html b/doc/exception_hpp.html index 05cb8b2..01c3674 100644 --- a/doc/exception_hpp.html +++ b/doc/exception_hpp.html @@ -31,9 +31,9 @@ #include <boost/exception_ptr.hpp>

    See Also:

    -
    Boost Exception
    -
    Diagnostic Information
    +
    diff --git a/doc/functions.html b/doc/functions.html new file mode 100644 index 0000000..298dcc9 --- /dev/null +++ b/doc/functions.html @@ -0,0 +1,69 @@ + + + + + Functions + + + +
    + +
    + + diff --git a/doc/get_error_info.html b/doc/get_error_info.html index 34f9ba2..e7cdeef 100644 --- a/doc/get_error_info.html +++ b/doc/get_error_info.html @@ -21,21 +21,19 @@

    get_error_info

    -

    #include <boost/exception/get_error_info.hpp>

    -
    namespace
    +
    namespace
     boost
         {
         template <class ErrorInfo,class E>
    -    shared_ptr<typename ErrorInfo::value_type const> get_error_info( E const & x );
    +    typename ErrorInfo::value_type const * get_error_info( E const & x );
         }

    Requirements:

    • ErrorInfo must be an instance of the error_info template.
    • E must be polymorphic.
    • -
    • The get_error_info function must not be called outside of a catch block.

    Returns:

    -
    -

    Finally here is how the handler retreives data from exceptions that derive from boost::exception:

    +

    Finally here is how the handler retrieves data from exceptions that derive from boost::exception:

    catch( io_error & e )
         {
         std::cerr << "I/O Error!\n";
    diff --git a/doc/name_idx.html b/doc/page_idx.html
    similarity index 84%
    rename from doc/name_idx.html
    rename to doc/page_idx.html
    index 4f3dfc8..4408d0f 100644
    --- a/doc/name_idx.html
    +++ b/doc/page_idx.html
    @@ -3,7 +3,7 @@
     
     
     	
    -	Index
    +	page index
     	
     
     
    @@ -19,12 +19,14 @@
     
     
     
    -

    Index

    +

    +

    See Also:

    + +
    diff --git a/doc/source/boost-exception.reno b/doc/source/boost-exception.reno index f61dc8a..2b6c064 100644 --- a/doc/source/boost-exception.reno +++ b/doc/source/boost-exception.reno @@ -39,7 +39,7 @@ - 48 + 56 0 @@ -48,16 +48,114 @@ reno_context + + + + + + 2 + 9748FFBBC9F02FEB97E0BA1E6280C51FFF5D7F217F0F12EE8ED29F6BE5CCCE44 + 2533933282 + 8724 + 615 + E23085202D084CBB50F289988A6A592F06D923B77D0AB25D7A98A7188DF5BE3B + 1414247481 + 766 + 7388 + + + + + + 0 + ../../../../boost/exception_ptr.hpp + 0 + 0 + + + + + <string>current_exception</string> + + + + + + + + + 1 + 2 + (:include include:) (:auto also:) + + + + + 0 + + 6 + + reno_context + + + + + + + 2 + F7537DC10435D0F7CC368E0FC747B2B1169E1CE60FCBAE8AC86F2256667C95B2 + 3301865866 + 4151 + 557 + D747B0A0953B72747224DE7856DB793A4BFF7B73793873CF22810FCB304A7310 + 505472020 + 3665 + 26 + + + + + + 0 + ../../../../boost/exception/diagnostic_information.hpp + 0 + 0 + + + + + <string>diagnostic_information</string> + + + + + + + + + 1 + 2 + (:include include:) (:auto also:) + + + + + 0 + + 7 + + reno_context + 1 - 17FF6C63843EE64ED66CB038DD95B4C4D6BA1B0FD36B27BEFD84A909161D2853 - 1237535165 - 231 - 1186 + 04DDC793002AFCF4F4166D250C67D09B6FE8B86224318ED7847AD6EC423B70CA + 922651615 + 433 + 1027 @@ -82,14 +180,287 @@ 1 2 - (:include include:) (:pagelist link="backlink":) + (:include include:) (:auto also:) 0 - 6 + 8 + + reno_context + + + + + + + 0 + + + + + + 1 + + + + + <string>transporting of arbitrary data to the catch site</string> + + + tutorial_transporting_data + + + + + + 1 + 2 + (:include include:) (:auto also:) + + + + + 0 + + 9 + + reno_context + + + + + + + 0 + + + + + + 1 + + + + + <string>Motivation</string> + + + motivation + + + + + + 7 + 2 + (:include include:) (:auto also explicit=" + 1 + + 0 + + 10 + + reno_context + + + + + + + 0 + + + + + + 1 + + + + + <string>exception types as simple semantic tags</string> + + + + + + + + 2 + + 1 + + 0 + + 11 + + reno_context + + + + + + + 1 + D9B8E6AA12A4F33953B1A961FA590C5A3840234B6531CA8C04AC985AD5800835 + 2432554768 + 702 + 408 + + + + + + 0 + ../../example/enable_error_info.cpp + 0 + 0 + + + + + <string>integrating boost exception in existing exception class hierarchies</string> + + + tutorial_enable_error_info + + + + + 2 + + 1 + + 0 + + 12 + + reno_context + + + + + + + 0 + + + + + + 1 + + + + + <string>frequently asked questions</string> + + + + + + + + 2 + ":) + + + + + 0 + + -10 + + + + 1 + 2 + (:include include:) (:auto also:) + + + + + 0 + + -11 + + + + 1 + 2 + (:include include:) (:auto also:) + + + + + 0 + + -12 + + + + 1 + 2 + (:include include:) (:auto also:) + + + + + 0 + + 13 + + reno_context + + + + + + + 2 + 9748FFBBC9F02FEB97E0BA1E6280C51FFF5D7F217F0F12EE8ED29F6BE5CCCE44 + 2533933282 + 8724 + 615 + F86EB07D04CD0D0645080D1121DA899746D0C45137E17E1D9BE605E75396F047 + 1983537541 + 1346 + 148 + + + + + + 0 + ../../../../boost/exception_ptr.hpp + 0 + 0 + + + + + <string>exception_ptr</string> + + + + + + + + + 1 + 2 + (:include include:) (:auto also:) + + + + + 0 + + 14 reno_context @@ -138,7 +509,7 @@ 0 - 7 + 15 reno_context @@ -148,28 +519,28 @@ 2 - 808CABE6CCA47C52CC9DD21911BF0B42284A5DD55AC3E665B29ED2B5F16AF7DA - 3660693492 - 8718 - 487 - 0066D4E6E6B189906E6DE04F08509F3737511701A1B1355B37511EC18E8371F4 - 2078296250 - 305 - 8150 + 1D3204D3ADDAB7AA716BEA1489EA852A9D6B5C110243364F6931FEF1CC2E5F88 + 422052608 + 3923 + 518 + D31BCE814DF5B8B718E7EB67A194AD08EF716A26D422E436596ABA1F145007D8 + 4055211476 + 525 + 3392 0 - ../../../../boost/exception_ptr.hpp + ../../../../boost/exception/info.hpp 0 0 - <string>copy_exception</string> + <string>exception/operator<<</string> @@ -187,7 +558,7 @@ 0 - 8 + 16 reno_context @@ -196,29 +567,33 @@ - 2 - 808CABE6CCA47C52CC9DD21911BF0B42284A5DD55AC3E665B29ED2B5F16AF7DA - 3660693492 - 8718 - 487 - E23085202D084CBB50F289988A6A592F06D923B77D0AB25D7A98A7188DF5BE3B - 1414247481 - 766 - 7382 + 3 + 612485E090D76B2CC43C1A296F813075BA165C2496082E78E939F10B3DA8E09A + 1770110914 + 587 + 1462 + 60F3F48B87487FA6E0D2CCC0750AF435CC92CEC80BBBF609AC71295031AADD0D + 3929437933 + 361 + 213 + CD1241D84950468704F3C3F04116B8DA5162A8BEA4364F10951232F49113C5DE + 1658463867 + 121 + 238 0 - ../../../../boost/exception_ptr.hpp + ../../../../boost/throw_exception.hpp 0 0 - <string>current_exception</string> + <string>configuration macros</string> @@ -236,7 +611,7 @@ 0 - 9 + 17 reno_context @@ -246,27 +621,27 @@ 1 - D9B8E6AA12A4F33953B1A961FA590C5A3840234B6531CA8C04AC985AD5800835 - 2432554768 - 702 - 408 + 7116AEECEA666794E31DC99390ADEC1BA6AF74B2398067A0739767B4B76FA97A + 4128134227 + 307 + 302 0 - ../../example/enable_error_info.cpp + ../../example/logging.cpp 0 0 - <string>integrating boost exception in existing exception class hierarchies</string> + <string>diagnostic information</string> - tutorial_enable_error_info + tutorial_diagnostic_information @@ -281,7 +656,56 @@ 0 - 10 + 18 + + reno_context + + + + + + + 2 + F7537DC10435D0F7CC368E0FC747B2B1169E1CE60FCBAE8AC86F2256667C95B2 + 3301865866 + 4151 + 557 + 90ECFCA1DA49DBB79A23B5998A39D8A6B122632524671C56DA10F96A1BA07CD2 + 1653443895 + 452 + 3693 + + + + + + 0 + ../../../../boost/exception/diagnostic_information.hpp + 0 + 0 + + + + + <string>current_exception_diagnostic_information</string> + + + + + + + + + 1 + 2 + (:include include:) (:auto also:) + + + + + 0 + + 19 reno_context @@ -319,50 +743,7 @@ 0 - 11 - - reno_context - - - - - - - 1 - F4C951B28F7DE500973AA3DFAA99F2BADA6EDAFA2B406C30BEF3B7FBE6FD57D7 - 2263754923 - 982 - 306 - - - - - - 0 - ../../example/error_info_2.cpp - 0 - 0 - - - - - <string>adding of arbitrary data to active exception objects</string> - - - adding_data_later - - - - - - 0 - - - - - 0 - - 12 + 20 reno_context @@ -372,14 +753,14 @@ 2 - E8AFD260BD0196A516F0E29A9FE6D09BF84B37D31E228910E3370365CAA4AB43 - 3229661566 - 3665 + FEABD2D011FBCE667D26BAD68A1C65D81E98DD40081CC70F2738AC3151A8FC4A + 4260129224 + 2393 504 - BB8AF986C96801345719855FEA083AF5684FBC349F6520E150F19A6370019265 - 3731478139 - 686 - 2973 + C708EDCAC3964E2F3C3A081700112C5F15C7BF7A61FDF2EF39D112FC9B987CE3 + 1739153824 + 2361 + 26 @@ -411,7 +792,7 @@ 0 - 13 + 21 reno_context @@ -421,9 +802,9 @@ 2 - 00067869F918D0E8905D8A464C17FA9DAD9F497B3A172EB360239EEB5778A206 - 3465219615 - 4025 + 1D3204D3ADDAB7AA716BEA1489EA852A9D6B5C110243364F6931FEF1CC2E5F88 + 422052608 + 3923 518 6E325144EF4F41FA3A225EB30729101382C4E99B3D6160E307311E4B4E641010 1097215175 @@ -460,278 +841,7 @@ 0 - 14 - - reno_context - - - - - - - 1 - FC684D0DD5A9732B4130F2AB3DB6E0491D0F523E14B7FB738B2019EA2C7F8717 - 2229778754 - 631 - 319 - - - - - - 0 - ../../example/cloning_2.cpp - 0 - 0 - - - - - <string>cloning and re-throwing an exception</string> - - - cloning_and_rethrowing - - - - - - 0 - - - - - 0 - - 15 - - reno_context - - - - - - - 0 - - - - - - 1 - - - - - <string>transporting of arbitrary data to the catch site</string> - - - tutorial_transporting_data - - - - - - 1 - 2 - (:include include:) (:auto also:) - - - - - 0 - - 16 - - reno_context - - - - - - - 0 - - - - - - 1 - - - - - <string>Motivation</string> - - - motivation - - - - - - 7 - 2 - (:include include:) (:auto also explicit=" - 1 - - 0 - - 17 - - reno_context - - - - - - - 0 - - - - - - 1 - - - - - <string>exception types as simple semantic tags</string> - - - - - - - - 2 - - 1 - - 0 - - -9 - - - 2 - - 1 - - 0 - - 18 - - reno_context - - - - - - - 0 - - - - - - 1 - - - - - <string>frequently asked questions</string> - - - - - - - - 2 - ":) - - - - - 0 - - -17 - - - - 1 - 2 - (:include include:) (:auto also:) - - - - - 0 - - -18 - - - - 1 - 2 - (:include include:) (:auto also:) - - - - - 0 - - 19 - - reno_context - - - - - - - 2 - 00067869F918D0E8905D8A464C17FA9DAD9F497B3A172EB360239EEB5778A206 - 3465219615 - 4025 - 518 - D31BCE814DF5B8B718E7EB67A194AD08EF716A26D422E436596ABA1F145007D8 - 4055211476 - 525 - 3494 - - - - - - 0 - ../../../../boost/exception/info.hpp - 0 - 0 - - - - - <string>exception/operator<<</string> - - - - - - - - - 1 - 2 - (:include include:) (:auto also:) - - - - - 0 - - 20 + 22 reno_context @@ -780,7 +890,99 @@ 0 - 21 + 23 + + reno_context + + + + + + + 1 + FC684D0DD5A9732B4130F2AB3DB6E0491D0F523E14B7FB738B2019EA2C7F8717 + 2229778754 + 631 + 319 + + + + + + 0 + ../../example/cloning_2.cpp + 0 + 0 + + + + + <string>cloning and re-throwing an exception</string> + + + cloning_and_rethrowing + + + + + + 0 + + + + + 0 + + 24 + + reno_context + + + + + + + 2 + 9748FFBBC9F02FEB97E0BA1E6280C51FFF5D7F217F0F12EE8ED29F6BE5CCCE44 + 2533933282 + 8724 + 615 + 0066D4E6E6B189906E6DE04F08509F3737511701A1B1355B37511EC18E8371F4 + 2078296250 + 305 + 8156 + + + + + + 0 + ../../../../boost/exception_ptr.hpp + 0 + 0 + + + + + <string>copy_exception</string> + + + + + + + + + 1 + 2 + (:include include:) (:auto also:) + + + + + 0 + + 25 reno_context @@ -829,7 +1031,7 @@ 0 - 22 + 26 reno_context @@ -874,7 +1076,7 @@ 0 - 23 + 27 reno_context @@ -884,9 +1086,9 @@ 1 - F6C6B72C2CDEBC5E3EAA924F637563A8F8A95684AF6EEF39FE2260C86C77F531 - 2151348977 - 3846 + 2F432507CFD796BE673F33D9AC68C535F1ED1F4FCD3A8E3AEEC320D9795FB4AE + 2319362875 + 2574 323 @@ -919,7 +1121,7 @@ 0 - 24 + 28 reno_context @@ -968,7 +1170,7 @@ 0 - 25 + 29 reno_context @@ -997,1235 +1199,41 @@ - 127 + 1 2 - !!Introduction The purpose of Boost Exception is to ease the design of exception class hierarchies and to help write exception handling and error reporting code. It supports transporting of arbitrary data to the catch site, which is otherwise tricky due to the no-throw requirements (15.5.1) for exception types. Data can be added to any exception object, either directly in the throw-expression (15.1), or at a later time as the exception object propagates up the call stack. The ability to add data to exception objects after they have been passed to throw is important, because often some of the information needed to handle an exception is unavailable in the context where the failure is detected. Boost Exception also supports (:link http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2179.html|N2179:)-style (:link - 1 - - 0 - - 26 - - reno_context - - - - - - - 0 - - - - - - 1 - - - - - <string>transporting of exceptions between threads</string> - - - tutorial_exception_ptr - - - - - 2 - |copying:) of exception objects, implemented non-intrusively and automatically by the boost::(:link - 1 - - 0 - - 27 - - reno_context - - - - - - - 2 - 612485E090D76B2CC43C1A296F813075BA165C2496082E78E939F10B3DA8E09A - 1770110914 - 587 - 1497 - 60F3F48B87487FA6E0D2CCC0750AF435CC92CEC80BBBF609AC71295031AADD0D - 3929437933 - 361 - 213 - - - - - - 0 - ../../../../boost/throw_exception.hpp - 0 - 0 - - - - - <string>throw_exception</string> - - - - - - - - 2 - :) function. !!Contents #(:link - 1 - - 0 - - -16 - - - 2 - :) #Tutorial ##(:link - 1 - - 0 - - -15 - - - 2 - mod="w":) ##(:link - 1 - - 0 - - 28 - - reno_context - - - - - - - 1 - 7116AEECEA666794E31DC99390ADEC1BA6AF74B2398067A0739767B4B76FA97A - 4128134227 - 307 - 302 - - - - - - 0 - ../../example/logging.cpp - 0 - 0 - - - - - <string>diagnostic information</string> - - - tutorial_diagnostic_information - - - - - 2 - mod="w":) ##(:link - 1 - - 0 - - -9 - - - 2 - mod="w":) ##(:link - 1 - - 0 - - -26 - - - 2 - mod="w":) ##(:link - 1 - - 0 - - -17 - - - 2 - mod="w":) ##(:link - 1 - - 0 - - 29 - - reno_context - - - - - - - 0 - - - - - - 1 - - - - - <string>using virtual inheritance in exception types</string> - - - - - - - - 2 - mod="w":) #Documentation ##Class (:link - 1 - - 0 - - 30 - - reno_context - - - - - - - 2 - 55F1164770FD778354E151EF65A3E830DA20F325F7ED20A95130A4B83FC801BF - 1282550303 - 9192 - 323 - 65D35B8A2063883A53E9D0DCC3FF8E5CA3573A58451A653CDE3003FFBEC576D3 - 1693870740 - 2195 - 3720 - - - - - - 0 - ../../../../boost/exception/exception.hpp - 0 - 0 - - - - - <string>exception</string> - - - - - - - - 2 - :) ##Transporting of Arbitrary Data to the Catch Site ###(:link - 1 - - 0 - - 31 - - reno_context - - - - - - - 2 - 126BB1D8971585CBE7D78EF3C12259D72FD5E973A84626AA9FC3234220A11CAB - 3471702891 - 969 - 344 - A7FD310E1340E103081DA2A7899DA0E213C696C84D52C17ADA09F6942EE97D47 - 2978648279 - 530 - 433 - - - - - - 0 - ../../../../boost/exception/detail/error_info_impl.hpp - 0 - 0 - - - - - <string>error_info</string> - - - - - - - - 2 - :) ###(:link - 1 - - 0 - - -19 - - - 2 - :) ###(:link - 1 - - 0 - - -21 - - - 2 - :) ###(:link - 1 - - 0 - - -12 - - - 2 - :) ###(:link - 1 - - 0 - - -6 - - - 2 - :) ##(:link http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2179.html|N2179:) Transporting of Exceptions between Threads ###(:link - 1 - - 0 - - 32 - - reno_context - - - - - - - 2 - 808CABE6CCA47C52CC9DD21911BF0B42284A5DD55AC3E665B29ED2B5F16AF7DA - 3660693492 - 8718 - 487 - F86EB07D04CD0D0645080D1121DA899746D0C45137E17E1D9BE605E75396F047 - 1983537541 - 1346 - 148 - - - - - - 0 - ../../../../boost/exception_ptr.hpp - 0 - 0 - - - - - <string>exception_ptr</string> - - - - - - - - 2 - :) ###(:link - 1 - - 0 - - -20 - - - 2 - :) ###(:link - 1 - - 0 - - -8 - - - 2 - :) ###(:link - 1 - - 0 - - -7 - - - 2 - :) ###(:link - 1 - - 0 - - 33 - - reno_context - - - - - - - 2 - 808CABE6CCA47C52CC9DD21911BF0B42284A5DD55AC3E665B29ED2B5F16AF7DA - 3660693492 - 8718 - 487 - 0E9DF8366080712A816BE91ABCEF1E2044145B63D75B0B995B537900F378189E - 1069696031 - 255 - 8457 - - - - - - 0 - ../../../../boost/exception_ptr.hpp - 0 - 0 - - - - - <string>rethrow_exception</string> - - - - - - - - 2 - :) ###(:link - 1 - - 0 - - 34 - - reno_context - - - - - - - 2 - 808CABE6CCA47C52CC9DD21911BF0B42284A5DD55AC3E665B29ED2B5F16AF7DA - 3660693492 - 8718 - 487 - DA033132CFA8F85C147C01F51FF7CF7399CF7D32D412F730EA3219CDAC608C72 - 3830952485 - 712 - 1496 - - - - - - 0 - ../../../../boost/exception_ptr.hpp - 0 - 0 - - - - - <string>unknown_exception</string> - - - - - - - - 2 - :) ##(:link - 1 - - 0 - - 35 - - reno_context - - - - - - - 2 - 3D64A3F5639045A59A0CD362AD4C531ECC763B7C523E284DCBFBACAAF5F681C3 - 4142572795 - 1596 - 462 - 6FE1F0AF570A010E8FDA1647DE61E0CC3AA979C8A8638722DAACDF8FBC4790D2 - 1246830037 - 1023 - 567 - - - - - - 0 - ../../../../boost/exception/diagnostic_information.hpp - 0 - 0 - - - - - <string>diagnostic_information</string> - - - - - - - - 2 - :) ##(:link - 1 - - 0 - - -27 - - - 2 - :), (:link - 1 - - 0 - - -5 - - - 2 - :) ##(:link - 1 - - 0 - - 36 - - reno_context - - - - - - - 3 - 612485E090D76B2CC43C1A296F813075BA165C2496082E78E939F10B3DA8E09A - 1770110914 - 587 - 1497 - 60F3F48B87487FA6E0D2CCC0750AF435CC92CEC80BBBF609AC71295031AADD0D - 3929437933 - 361 - 213 - CD1241D84950468704F3C3F04116B8DA5162A8BEA4364F10951232F49113C5DE - 1658463867 - 121 - 238 - - - - - - 0 - ../../../../boost/throw_exception.hpp - 0 - 0 - - - - - <string>configuration macros</string> - - - - - - - - 2 - mod="w":) ##Headers ###(:link - 1 - - 0 - - 37 - - reno_context - - - - - - - 1 - F647827E95C64B626A8E3751AD4E4D21237DD17482EEA6DB93A16A2C6AC79E87 - 527078204 - 446 - 227 - - - - - - 0 - ../../../../boost/exception.hpp - 0 - 0 - - - - - <string>boost/exception.hpp</string> - - - exception_hpp - - - - - 2 - :) ###(:link - 1 - - 0 - - 38 - - reno_context - - - - - - - 1 - 77680088697752BD6CCF429C0B264C866F5BF1D911D3BF3F1F18B06490D9F0CB - 2016079400 - 1841 - 227 - - - - - - 0 - ../../../../boost/exception/diagnostic_information.hpp - 0 - 0 - - - - - <string>boost/exception/diagnostic_information.hpp</string> - - - exception_diagnostic_information_hpp - - - - - 2 - :) ###(:link - 1 - - 0 - - -10 - - - 2 - :) ###(:link - 1 - - 0 - - 39 - - reno_context - - - - - - - 0 - - - - - - 1 - - - - - <string>boost/exception/enable_error_info.hpp</string> - - - exception_enable_error_info_hpp - - - - - 2 - :) ###(:link - 1 - - 0 - - 40 - - reno_context - - - - - - - 2 - 9A4ECF9A49A73AED83C1565CB8C67AE1519E8AFE6818F968B4C4733CB9E86CEF - 1615599655 - 68 - 227 - 34F0583BC8DE767CE2D79721E1F956895E43E5397473B1050F59BE7E26C773DB - 805836816 - 66 - 1 - - - - - - 0 - ../../../../boost/exception/error_info.hpp - 0 - 0 - - - - - <string>boost/exception/error_info.hpp</string> - - - exception_error_info_value_hpp - - - - - 2 - :) ###(:link - 1 - - 0 - - -22 - - - 2 - :) ###(:link - 1 - - 0 - - -23 - - - 2 - :) ###(:link - 1 - - 0 - - 41 - - reno_context - - - - - - - 1 - 3D40DD88A1E41D75BC79CA8DACC35BEE2A16A64422AC8E6BE0D61169D9360EF7 - 4184757263 - 4220 - 323 - - - - - - 0 - ../../../../boost/exception/info.hpp - 0 - 0 - - - - - <string>boost/exception/info.hpp</string> - - - exception_error_info_hpp - - - - - 2 - :) ###(:link - 1 - - 0 - - 42 - - reno_context - - - - - - - 1 - CAD6C404CB725D336A44920D2341ECA131149AB02C368B59028F8147F16737BF - 2258638601 - 94 - 227 - - - - - - 0 - ../../../../boost/exception/info_tuple.hpp - 0 - 0 - - - - - <string>boost/exception/info_tuple.hpp</string> - - - exception_error_info_group_hpp - - - - - 2 - :) ###(:link - 1 - - 0 - - 43 - - reno_context - - - - - - - 1 - FBC69CDA5E19FA40270F3855A8B99B2F77572439353F9DC5D15386F3520BC616 - 1405483403 - 8882 - 323 - - - - - - 0 - ../../../../boost/exception_ptr.hpp - 0 - 0 - - - - - <string>boost/exception_ptr.hpp</string> - - - exception_cloning_hpp - - - - - 2 - :) ###(:link - 1 - - 0 - - 44 - - reno_context - - - - - - - 1 - 373FAB70D1DAE4F1111AACCCCD3F6B55EAF8D1222E03A26A5A2F860B70D2D0C4 - 3697768091 - 2013 - 91 - - - - - - 0 - ../../../../boost/throw_exception.hpp - 0 - 0 - - - - - <string>boost/throw_exception.hpp</string> - - - throw_exception_hpp - - - - - 2 - :) #(:link - 1 - - 0 - - -18 - - - 2 - mod="w":) #(:link - 1 - - 0 - - 45 - - reno_context - - - - - - - 0 - - - - - - 1 - - - - - <string>Index</string> - - - name_idx - - - - - 2 - :) !!Synopsis `#include <(:link - 1 - - 0 - - -37 - - - 2 - :)> [@namespace boost { (:include - 1 - - 0 - - -22 - - - 2 - api pre_indent="4":) (:include - 1 - - 0 - - -41 - - - 2 - api pre_indent="4":) (:include - 1 - - 0 - - -42 - - - 2 - api pre_indent="4":) (:include - 1 - - 0 - - -39 - - - 2 - api pre_indent="4":) (:include - 1 - - 0 - - -38 - - - 2 - api pre_indent="4":) (:include - 1 - - 0 - - -43 - - - 2 - api pre_indent="4":) (:include - 1 - - 0 - - -10 - - - 2 - api pre_indent="4":) }@] `#include <(:link - 1 - - 0 - - -44 - - - 2 - :)> [@(:include - 1 - - 0 - - -44 - - - 2 - api:)@] !!Class exception (:include - 1 - - 0 - - -30 - - - 2 - :) !!Transporting of Arbitrary Data to the Catch Site (:include - 1 - - 0 - - -31 - - - 2 - :) (:include - 1 - - 0 - - -19 - - - 2 - :) (:include - 1 - - 0 - - -21 - - - 2 - :) (:include - 1 - - 0 - - -12 - - - 2 - :) (:include - 1 - - 0 - - -6 - - - 2 - :) !!Transporting of Exceptions between Threads (:include - 1 - - 0 - - -32 - - - 2 - :) (:include - 1 - - 0 - - -20 - - - 2 - :) (:include - 1 - - 0 - - -8 - - - 2 - :) (:include - 1 - - 0 - - -7 - - - 2 - :) (:include - 1 - - 0 - - -33 - - - 2 - :) (:include - 1 - - 0 - - -34 - - - 2 - :) !!Printing Diagnostic Information (:include - 1 - - 0 - - -35 - - - 2 - :) !!Throwing Exceptions (:include - 1 - - 0 - - -27 - - - 2 - :) (:include - 1 - - 0 - - -5 - - - 2 - :) !!Acknowledgements Peter Dimov has been continuously influencing the design and evolution of Boost Exception. Also thanks to Tobias Schwinger, Tom Brinkman, Pavel Vozenilek and everyone who participated in the review process. + (:include include:) 0 - -26 + 30 + + reno_context + + + + + + + 0 + + + + + + 1 + + + + + <string>transporting of exceptions between threads</string> + + + tutorial_exception_ptr + + @@ -2238,7 +1246,43 @@ 0 - -27 + 31 + + reno_context + + + + + + + 2 + 612485E090D76B2CC43C1A296F813075BA165C2496082E78E939F10B3DA8E09A + 1770110914 + 587 + 1462 + 60F3F48B87487FA6E0D2CCC0750AF435CC92CEC80BBBF609AC71295031AADD0D + 3929437933 + 361 + 213 + + + + + + 0 + ../../../../boost/throw_exception.hpp + 0 + 0 + + + + + <string>throw_exception</string> + + + + + @@ -2251,7 +1295,43 @@ 0 - -28 + 32 + + reno_context + + + + + + + 2 + 9748FFBBC9F02FEB97E0BA1E6280C51FFF5D7F217F0F12EE8ED29F6BE5CCCE44 + 2533933282 + 8724 + 615 + 0E9DF8366080712A816BE91ABCEF1E2044145B63D75B0B995B537900F378189E + 1069696031 + 255 + 8463 + + + + + + 0 + ../../../../boost/exception_ptr.hpp + 0 + 0 + + + + + <string>rethrow_exception</string> + + + + + @@ -2264,7 +1344,32 @@ 0 - -29 + 33 + + reno_context + + + + + + + 0 + + + + + + 1 + + + + + <string>using virtual inheritance in exception types</string> + + + + + @@ -2277,7 +1382,43 @@ 0 - -30 + 34 + + reno_context + + + + + + + 2 + 55F1164770FD778354E151EF65A3E830DA20F325F7ED20A95130A4B83FC801BF + 1282550303 + 9192 + 323 + 65D35B8A2063883A53E9D0DCC3FF8E5CA3573A58451A653CDE3003FFBEC576D3 + 1693870740 + 2195 + 3720 + + + + + + 0 + ../../../../boost/exception/exception.hpp + 0 + 0 + + + + + <string>exception</string> + + + + + @@ -2290,7 +1431,43 @@ 0 - -31 + 35 + + reno_context + + + + + + + 2 + 126BB1D8971585CBE7D78EF3C12259D72FD5E973A84626AA9FC3234220A11CAB + 3471702891 + 969 + 344 + A7FD310E1340E103081DA2A7899DA0E213C696C84D52C17ADA09F6942EE97D47 + 2978648279 + 530 + 433 + + + + + + 0 + ../../../../boost/exception/detail/error_info_impl.hpp + 0 + 0 + + + + + <string>error_info</string> + + + + + @@ -2303,7 +1480,86 @@ 0 - -32 + 36 + + reno_context + + + + + + + 1 + 4ED9709788BBAB4DE7CF336561606B8C0B41F70877A3395F4EE026F4AEB66CC6 + 743998427 + 409 + 307 + + + + + + 0 + ../../example/cloning_1.cpp + 0 + 0 + + + + + <string>using enable_current_exception at the time of the throw</string> + + + using_enable_cloning + + + + + + 0 + + + + + 0 + + 37 + + reno_context + + + + + + + 2 + 9748FFBBC9F02FEB97E0BA1E6280C51FFF5D7F217F0F12EE8ED29F6BE5CCCE44 + 2533933282 + 8724 + 615 + 9F3671DA5E8AB414F1FBA3B160D49134EAEE8DFF33E95376EDB41534E916FF38 + 2436936467 + 718 + 1496 + + + + + + 0 + ../../../../boost/exception_ptr.hpp + 0 + 0 + + + + + <string>unknown_exception</string> + + + + + @@ -2316,7 +1572,43 @@ 0 - -33 + 38 + + reno_context + + + + + + + 2 + 6FB85B536F965F137409D5B5D34786DCBF0B9957A7C251D271B717A1156B823D + 1090406464 + 362 + 323 + D16DAEA8B1792A019AF7FCA362FDC6EFD381AF4C43C076A01C029ECE51F994A6 + 3172941848 + 330 + 26 + + + + + + 0 + ../../../../boost/exception/current_exception_cast.hpp + 0 + 0 + + + + + <string>current_exception_cast</string> + + + + + @@ -2329,7 +1621,32 @@ 0 - -34 + 39 + + reno_context + + + + + + + 0 + + + + + + 1 + + + + + <string>Types</string> + + + types + + @@ -2342,7 +1659,82 @@ 0 - -35 + 40 + + reno_context + + + + + + + 1 + F4C951B28F7DE500973AA3DFAA99F2BADA6EDAFA2B406C30BEF3B7FBE6FD57D7 + 2263754923 + 982 + 306 + + + + + + 0 + ../../example/error_info_2.cpp + 0 + 0 + + + + + <string>adding of arbitrary data to active exception objects</string> + + + adding_data_later + + + + + + 0 + + + + + 0 + + 41 + + reno_context + + + + + + + 1 + 9E3988368193B192FA2426DE2B97FA8D0DA8A9FFECAD6A010FE1B5CD9662FAE9 + 109897168 + 4491 + 227 + + + + + + 0 + ../../../../boost/exception/diagnostic_information.hpp + 0 + 0 + + + + + <string>boost/exception/diagnostic_information.hpp</string> + + + exception_diagnostic_information_hpp + + @@ -2355,7 +1747,47 @@ 0 - -36 + 42 + + reno_context + + + + + + + 3 + 55F1164770FD778354E151EF65A3E830DA20F325F7ED20A95130A4B83FC801BF + 1282550303 + 9192 + 323 + 65D35B8A2063883A53E9D0DCC3FF8E5CA3573A58451A653CDE3003FFBEC576D3 + 1693870740 + 2195 + 3720 + DA154372D8C23BD9EDC30005CA7959CE686D198891097A837D006B5222F04DE9 + 2768248809 + 143 + 60 + + + + + + 0 + ../../../../boost/exception/exception.hpp + 0 + 0 + + + + + <string>exception::exception</string> + + + exception_constructors + + @@ -2368,7 +1800,47 @@ 0 - -37 + 43 + + reno_context + + + + + + + 3 + 126BB1D8971585CBE7D78EF3C12259D72FD5E973A84626AA9FC3234220A11CAB + 3471702891 + 969 + 344 + A7FD310E1340E103081DA2A7899DA0E213C696C84D52C17ADA09F6942EE97D47 + 2978648279 + 530 + 433 + 02372FA6B987EAC15E78C5A12036F203A92B3D4C857C02985B1BF0A24008D976 + 2987989218 + 109 + 259 + + + + + + 0 + ../../../../boost/exception/detail/error_info_impl.hpp + 0 + 0 + + + + + <string>error_info::value</string> + + + + + @@ -2381,7 +1853,32 @@ 0 - -38 + 44 + + reno_context + + + + + + + 0 + + + + + + 1 + + + + + <string>Functions</string> + + + functions + + @@ -2394,7 +1891,39 @@ 0 - -39 + 45 + + reno_context + + + + + + + 1 + CAD6C404CB725D336A44920D2341ECA131149AB02C368B59028F8147F16737BF + 2258638601 + 94 + 227 + + + + + + 0 + ../../../../boost/exception/info_tuple.hpp + 0 + 0 + + + + + <string>boost/exception/info_tuple.hpp</string> + + + exception_error_info_group_hpp + + @@ -2403,84 +1932,6 @@ (:include include:) (:auto also:) - - - 0 - - -40 - - - - 1 - 2 - (:include include:) (:auto also:) - - - - - 0 - - -41 - - - - 1 - 2 - (:include include:) (:auto also:) - - - - - 0 - - -42 - - - - 1 - 2 - (:include include:) (:auto also:) - - - - - 0 - - -43 - - - - 1 - 2 - (:include include:) (:auto also:) - - - - - 0 - - -44 - - - - 1 - 2 - (:include include:) (:auto also:) - - - - - 0 - - -45 - - - - 1 - 2 - (:auto !:) (:pagelist fmt="index" except_tags="index noindex" mod="w":) - - 0 @@ -2495,33 +1946,35 @@ 1 - 187BFD2B78A0DD006717B5B06FFD465E2468F521C32A86FB793F7A68AB5417F3 - 4276724153 - 574 - 382 + F647827E95C64B626A8E3751AD4E4D21237DD17482EEA6DB93A16A2C6AC79E87 + 527078204 + 446 + 227 0 - ../../example/error_info_1.cpp + ../../../../boost/exception.hpp 0 0 - <string>adding of arbitrary data at the point of the throw</string> + <string>boost/exception.hpp</string> - adding_data_at_throw + exception_hpp - 0 + 1 + 2 + (:include include:) (:auto also:) @@ -2590,36 +2043,21 @@ - 3 - 126BB1D8971585CBE7D78EF3C12259D72FD5E973A84626AA9FC3234220A11CAB - 3471702891 - 969 - 344 - A7FD310E1340E103081DA2A7899DA0E213C696C84D52C17ADA09F6942EE97D47 - 2978648279 - 530 - 433 - 02372FA6B987EAC15E78C5A12036F203A92B3D4C857C02985B1BF0A24008D976 - 2987989218 - 109 - 259 + 0 - 0 - ../../../../boost/exception/detail/error_info_impl.hpp - 0 - 0 + 1 - <string>error_info::value</string> + <string>boost/exception/enable_error_info.hpp</string> - + exception_enable_error_info_hpp @@ -2643,36 +2081,21 @@ - 3 - 55F1164770FD778354E151EF65A3E830DA20F325F7ED20A95130A4B83FC801BF - 1282550303 - 9192 - 323 - 65D35B8A2063883A53E9D0DCC3FF8E5CA3573A58451A653CDE3003FFBEC576D3 - 1693870740 - 2195 - 3720 - DA154372D8C23BD9EDC30005CA7959CE686D198891097A837D006B5222F04DE9 - 2768248809 - 143 - 60 + 0 - 0 - ../../../../boost/exception/exception.hpp - 0 - 0 + 1 - <string>exception::exception</string> + <string>Headers</string> - exception_constructors + headers @@ -2691,6 +2114,397 @@ reno_context + + + + + + 2 + 9A4ECF9A49A73AED83C1565CB8C67AE1519E8AFE6818F968B4C4733CB9E86CEF + 1615599655 + 68 + 227 + 34F0583BC8DE767CE2D79721E1F956895E43E5397473B1050F59BE7E26C773DB + 805836816 + 66 + 1 + + + + + + 0 + ../../../../boost/exception/error_info.hpp + 0 + 0 + + + + + <string>boost/exception/error_info.hpp</string> + + + exception_error_info_value_hpp + + + + + + 1 + 2 + (:include include:) (:auto also:) + + + + + 0 + + 51 + + reno_context + + + + + + + 0 + + + + + + 1 + + + + + <string>Macros</string> + + + macros + + + + + + 1 + 2 + (:include include:) (:auto also:) + + + + + 0 + + 52 + + reno_context + + + + + + + 1 + A449DE2B3A2CDAE9DD932C06D224B3E07C95EBACBB4EA5890CA4CCF2DC74A693 + 1718307056 + 4118 + 323 + + + + + + 0 + ../../../../boost/exception/info.hpp + 0 + 0 + + + + + <string>boost/exception/info.hpp</string> + + + exception_error_info_hpp + + + + + + 1 + 2 + (:include include:) (:auto also:) + + + + + 0 + + 53 + + reno_context + + + + + + + 1 + E127BAFA15A5B7031C0DD1817993041600F935B71E7BDE42E1F4AF50959B6AB3 + 2166367611 + 9016 + 323 + + + + + + 0 + ../../../../boost/exception_ptr.hpp + 0 + 0 + + + + + <string>boost/exception_ptr.hpp</string> + + + exception_cloning_hpp + + + + + + 1 + 2 + (:include include:) (:auto also:) + + + + + 0 + + 54 + + reno_context + + + + + + + 1 + 05698FEF1D553EDBC15212673561F5436DF771AA5488C8ED8164D303078DE08E + 119041194 + 1978 + 91 + + + + + + 0 + ../../../../boost/throw_exception.hpp + 0 + 0 + + + + + <string>boost/throw_exception.hpp</string> + + + throw_exception_hpp + + + + + + 1 + 2 + (:include include:) (:auto also:) + + + + + 0 + + 55 + + reno_context + + + + + + + 0 + + + + + + 1 + + + + + <string>page index</string> + + + page_idx + + + + + + 1 + 2 + (:include include:) (:auto also:) + + + + + 0 + + 56 + + reno_context + + + + + + + 1 + A14B5595A6DD87562792D402B48500AAD71FA1ABD75C14EDF089FCC7318CBB9B + 3469762901 + 468 + 227 + + + + + + 0 + ../../../../boost/exception/current_exception_cast.hpp + 0 + 0 + + + + + <string>boost/exception/current_exception_cast.hpp</string> + + + + + + + + + 1 + 2 + (:include include:) (:auto also:) + + + + + 0 + + 57 + + reno_context + + + + + + + 1 + D10E536B909EFFF78FB09E6242AEC7C74ACDD75AE7DF32B45870422B752E5D8E + 1903336130 + 557 + 382 + + + + + + 0 + ../../example/error_info_1.cpp + 0 + 0 + + + + + <string>adding of arbitrary data at the point of the throw</string> + + + adding_data_at_throw + + + + + + 0 + + + + + 0 + + 58 + + reno_context + + + + + + + 1 + 9E8DCE3BCF462A3A332DA70F61E46FA5C2AB791B95E33D3F2AF1307F53C84B1C + 1960675522 + 6483 + 591 + + + + + + 0 + ../../example/example_io.cpp + 0 + 0 + + + + + <string>diagnostic_information example</string> + + + + + + + + + 0 + + + + + 0 + + 59 + + reno_context + @@ -2730,7 +2544,7 @@ 0 - 51 + 60 reno_context @@ -2739,77 +2553,29 @@ - 1 - 4ED9709788BBAB4DE7CF336561606B8C0B41F70877A3395F4EE026F4AEB66CC6 - 743998427 - 409 - 307 + 0 - 0 - ../../example/cloning_1.cpp - 0 - 0 + 1 - <string>using enable_current_exception at the time of the throw</string> + <string>Synopsis</string> - using_enable_cloning + synopsis - 0 - - - - - 0 - - 52 - - reno_context - - - - - - - 1 - D0024B58523F5885E87F608259810B61D3BE489CEC885FFAE91118F1E43B10A4 - 399616739 - 6563 - 591 - - - - - - 0 - ../../example/example_io.cpp - 0 - 0 - - - - - <string>diagnostic_information example</string> - - - - - - - - - 0 + 1 + 2 + (:include include:) (:auto also:) @@ -2819,13 +2585,13 @@ def - 53 + 61 reno_layer - 48 + 56 0 @@ -3109,36 +2875,7 @@ - 7 - 2 - [@class (:link - 1 - - 0 - - -30 - - - 2 - :) { protected: (:include - 1 - - 0 - - -49 - - - 2 - decl pre_indent="4":) (:include - 1 - - 0 - - -24 - - - 2 - decl pre_indent="4":) };@] + 0 @@ -3149,45 +2886,7 @@ - 9 - 2 - [@template <class Tag,class T> class (:link - 1 - - 0 - - -31 - - - 2 - :) { public: (:include - 1 - - 0 - - -47 - - - 2 - decl pre_indent="4":) (:include - 1 - - 0 - - -13 - - - 2 - decl pre_indent="4":) (:include - 1 - - 0 - - -48 - - - 2 - decl pre_indent="4":) };@] + 0 @@ -3220,7 +2919,36 @@ - 0 + 7 + 2 + [@class (:link + 1 + + 0 + + -34 + + + 2 + :) { protected: (:include + 1 + + 0 + + -42 + + + 2 + decl pre_indent="4":) (:include + 1 + + 0 + + -28 + + + 2 + decl pre_indent="4":) };@] @@ -3231,7 +2959,45 @@ - 0 + 9 + 2 + [@template <class Tag,class T> class (:link + 1 + + 0 + + -35 + + + 2 + :) { public: (:include + 1 + + 0 + + -47 + + + 2 + decl pre_indent="4":) (:include + 1 + + 0 + + -21 + + + 2 + decl pre_indent="4":) (:include + 1 + + 0 + + -43 + + + 2 + decl pre_indent="4":) };@] @@ -3421,6 +3187,94 @@ 0 + + + 0 + + -53 + + + + 0 + + + + + 0 + + -54 + + + + 0 + + + + + 0 + + -55 + + + + 0 + + + + + 0 + + -56 + + + + 0 + + + + + 0 + + -57 + + + + 0 + + + + + 0 + + -58 + + + + 0 + + + + + 0 + + -59 + + + + 0 + + + + + 0 + + -60 + + + + 0 + + @@ -3428,13 +3282,13 @@ api - 54 + 62 reno_layer - 48 + 56 0 @@ -3497,6 +3351,251 @@ -10 + + 0 + + + + + 0 + + -11 + + + + 0 + + + + + 0 + + -12 + + + + 0 + + + + + 0 + + -13 + + + + 0 + + + + + 0 + + -14 + + + + 0 + + + + + 0 + + -15 + + + + 0 + + + + + 0 + + -16 + + + + 0 + + + + + 0 + + -17 + + + + 0 + + + + + 0 + + -18 + + + + 0 + + + + + 0 + + -19 + + + + 3 + 2 + [@(:include + 1 + + 0 + + -22 + + + 2 + decl:)@] + + + + + 0 + + -20 + + + + 0 + + + + + 0 + + -21 + + + + 0 + + + + + 0 + + -22 + + + + 0 + + + + + 0 + + -23 + + + + 0 + + + + + 0 + + -24 + + + + 0 + + + + + 0 + + -25 + + + + 0 + + + + + 0 + + -26 + + + + 11 + 2 + [@(:include + 1 + + 0 + + -34 + + + 2 + def:) (:include + 1 + + 0 + + -35 + + + 2 + decl:) typedef (:link + 1 + + 0 + + -35 + + + 2 + :)<struct tag_throw_function,char const *> throw_function; typedef (:link + 1 + + 0 + + -35 + + + 2 + :)<struct tag_throw_file,char const *> throw_file; typedef (:link + 1 + + 0 + + -35 + + + 2 + :)<struct tag_throw_line,int> throw_line;@] + + + + + 0 + + -27 + + 3 2 @@ -3512,251 +3611,6 @@ decl:)@] - - - 0 - - -11 - - - - 0 - - - - - 0 - - -12 - - - - 0 - - - - - 0 - - -13 - - - - 0 - - - - - 0 - - -14 - - - - 0 - - - - - 0 - - -15 - - - - 0 - - - - - 0 - - -16 - - - - 0 - - - - - 0 - - -17 - - - - 0 - - - - - 0 - - -18 - - - - 0 - - - - - 0 - - -19 - - - - 0 - - - - - 0 - - -20 - - - - 0 - - - - - 0 - - -21 - - - - 0 - - - - - 0 - - -22 - - - - 11 - 2 - [@(:include - 1 - - 0 - - -30 - - - 2 - def:) (:include - 1 - - 0 - - -31 - - - 2 - decl:) typedef (:link - 1 - - 0 - - -31 - - - 2 - :)<struct tag_throw_function,char const *> throw_function; typedef (:link - 1 - - 0 - - -31 - - - 2 - :)<struct tag_throw_file,char const *> throw_file; typedef (:link - 1 - - 0 - - -31 - - - 2 - :)<struct tag_throw_line,int> throw_line;@] - - - - - 0 - - -23 - - - - 3 - 2 - [@(:include - 1 - - 0 - - -12 - - - 2 - decl:)@] - - - - - 0 - - -24 - - - - 0 - - - - - 0 - - -25 - - - - 0 - - - - - 0 - - -26 - - - - 0 - - - - - 0 - - -27 - - - - 0 - - 0 @@ -3864,72 +3718,7 @@ - 15 - 2 - [@#include <(:link - 1 - - 0 - - -38 - - - 2 - :)> #include <(:link - 1 - - 0 - - -40 - - - 2 - :)> #include <(:link - 1 - - 0 - - -22 - - - 2 - :)> #include <(:link - 1 - - 0 - - -23 - - - 2 - :)> #include <(:link - 1 - - 0 - - -41 - - - 2 - :)> #include <(:link - 1 - - 0 - - -42 - - - 2 - :)> #include <(:link - 1 - - 0 - - -43 - - - 2 - :)>@] + 0 @@ -3940,18 +3729,7 @@ - 3 - 2 - [@(:include - 1 - - 0 - - -35 - - - 2 - decl:)@] + 0 @@ -3962,18 +3740,7 @@ - 3 - 2 - [@(:include - 1 - - 0 - - -6 - - - 2 - decl:)@] + 0 @@ -3984,18 +3751,7 @@ - 3 - 2 - [@(:include - 1 - - 0 - - -31 - - - 2 - decl:)@] + 0 @@ -4013,16 +3769,16 @@ 0 - -31 + -6 2 - def:) (:include + decl:) (:include 1 0 - -19 + -18 2 @@ -4037,18 +3793,7 @@ - 3 - 2 - [@(:include - 1 - - 0 - - -21 - - - 2 - decl:)@] + 0 @@ -4059,54 +3804,7 @@ - 11 - 2 - [@(:include - 1 - - 0 - - -34 - - - 2 - decl:) (:include - 1 - - 0 - - -32 - - - 2 - decl:) (:include - 1 - - 0 - - -7 - - - 2 - decl:) (:include - 1 - - 0 - - -8 - - - 2 - decl:) (:include - 1 - - 0 - - -33 - - - 2 - decl:)@] + 0 @@ -4117,27 +3815,7 @@ - 5 - 2 - [@(:include - 1 - - 0 - - -5 - - - 2 - decl:) namespace boost { (:include - 1 - - 0 - - -27 - - - 2 - decl:) }@] + 0 @@ -4148,7 +3826,18 @@ - 0 + 3 + 2 + [@(:include + 1 + + 0 + + -25 + + + 2 + decl:)@] @@ -4159,7 +3848,72 @@ - 0 + 15 + 2 + [@#include <(:link + 1 + + 0 + + -41 + + + 2 + :)> #include <(:link + 1 + + 0 + + -50 + + + 2 + :)> #include <(:link + 1 + + 0 + + -26 + + + 2 + :)> #include <(:link + 1 + + 0 + + -27 + + + 2 + :)> #include <(:link + 1 + + 0 + + -52 + + + 2 + :)> #include <(:link + 1 + + 0 + + -45 + + + 2 + :)> #include <(:link + 1 + + 0 + + -53 + + + 2 + :)>@] @@ -4181,7 +3935,18 @@ - 0 + 3 + 2 + [@(:include + 1 + + 0 + + -14 + + + 2 + decl:)@] @@ -4203,7 +3968,18 @@ - 0 + 3 + 2 + [@(:include + 1 + + 0 + + -35 + + + 2 + decl:)@] @@ -4224,6 +4000,192 @@ -52 + + 5 + 2 + [@(:include + 1 + + 0 + + -35 + + + 2 + def:) (:include + 1 + + 0 + + -15 + + + 2 + decl:)@] + + + + + 0 + + -53 + + + + 11 + 2 + [@(:include + 1 + + 0 + + -37 + + + 2 + decl:) (:include + 1 + + 0 + + -13 + + + 2 + decl:) (:include + 1 + + 0 + + -24 + + + 2 + decl:) (:include + 1 + + 0 + + -5 + + + 2 + decl:) (:include + 1 + + 0 + + -32 + + + 2 + decl:)@] + + + + + 0 + + -54 + + + + 5 + 2 + [@(:include + 1 + + 0 + + -7 + + + 2 + decl:) namespace boost { (:include + 1 + + 0 + + -31 + + + 2 + decl:) }@] + + + + + 0 + + -55 + + + + 0 + + + + + 0 + + -56 + + + + 3 + 2 + [@(:include + 1 + + 0 + + -38 + + + 2 + decl:)@] + + + + + 0 + + -57 + + + + 0 + + + + + 0 + + -58 + + + + 0 + + + + + 0 + + -59 + + + + 0 + + + + + 0 + + -60 + + 0 @@ -4235,13 +4197,13 @@ decl - 55 + 63 reno_layer - 48 + 56 0 @@ -4250,18 +4212,18 @@ - 19 + 5 2 - [@#if !defined( BOOST_NO_EXCEPTIONS ) && !defined( BOOST_EXCEPTION_DISABLE ) #include < + [@(:link 1 0 - -22 + -13 2 - > #include <boost/current_function.hpp> #define + :) (:link 1 0 @@ -4270,70 +4232,7 @@ 2 - (x)\ ::boost:: - 1 - - 0 - - -27 - - - 2 - ( ::boost:: - 1 - - 0 - - -6 - - - 2 - (x) <<\ ::boost::(:link - 1 - - 0 - - -22 - - - 2 - |throw_function:)(BOOST_CURRENT_FUNCTION) <<\ ::boost::(:link - 1 - - 0 - - -22 - - - 2 - |throw_file:)(__FILE__) <<\ ::boost::(:link - 1 - - 0 - - -22 - - - 2 - |throw_line:)((int)__LINE__) ) #else #define - 1 - - 0 - - -5 - - - 2 - (x) ::boost:: - 1 - - 0 - - -27 - - - 2 - (x) #endif@] + :)();@] @@ -4346,7 +4245,7 @@ 3 2 - [@template <class T> ---unspecified--- (:link + [@template <class E> std::string (:link 1 0 @@ -4355,7 +4254,7 @@ 2 - :)( T const & x );@] + :)( E const & e );@] @@ -4366,18 +4265,18 @@ - 5 + 19 2 - [@template <class T> (:link + [@#if !defined( BOOST_EXCEPTION_DISABLE ) #include <(:link 1 0 - -32 + -26 2 - :) (:link + :)> #include <boost/current_function.hpp> #define (:link 1 0 @@ -4386,7 +4285,70 @@ 2 - :)( T const & e );@] + :)(x)\ ::boost::(:link + 1 + + 0 + + -31 + + + 2 + :)( ::boost::(:link + 1 + + 0 + + -14 + + + 2 + :)(x) <<\ ::boost::(:link + 1 + + 0 + + -26 + + + 2 + |throw_function:)(BOOST_CURRENT_FUNCTION) <<\ ::boost::(:link + 1 + + 0 + + -26 + + + 2 + |throw_file:)(__FILE__) <<\ ::boost::(:link + 1 + + 0 + + -26 + + + 2 + |throw_line:)((int)__LINE__) ) #else #define (:link + 1 + + 0 + + -7 + + + 2 + :)(x) ::boost::(:link + 1 + + 0 + + -31 + + + 2 + :)(x) #endif@] @@ -4397,27 +4359,7 @@ - 5 - 2 - [@(:link - 1 - - 0 - - -32 - - - 2 - :) (:link - 1 - - 0 - - -8 - - - 2 - :)();@] + 0 @@ -4461,18 +4403,7 @@ - 3 - 2 - [@template <class ErrorInfo,class E> (:link http://www.boost.org/libs/smart_ptr/shared_ptr.htm|shared_ptr:)<typename ErrorInfo::value_type const> (:link - 1 - - 0 - - -12 - - - 2 - :)( E const & x );@] + 0 @@ -4482,6 +4413,158 @@ -13 + + 3 + 2 + [@typedef ---unspecified--- (:link + 1 + + 0 + + -13 + + + 2 + :);@] + + + + + 0 + + -14 + + + + 3 + 2 + [@template <class T> ---unspecified--- (:link + 1 + + 0 + + -14 + + + 2 + :)( T const & x );@] + + + + + 0 + + -15 + + + + 5 + 2 + [@template <class E, class Tag, class T> E const & (:link + 1 + + 0 + + -15 + + + 2 + mod="/":)( E const & x, (:link + 1 + + 0 + + -35 + + + 2 + :)<Tag,T> const & v );@] + + + + + 0 + + -16 + + + + 0 + + + + + 0 + + -17 + + + + 0 + + + + + 0 + + -18 + + + + 3 + 2 + [@std::string (:link + 1 + + 0 + + -18 + + + 2 + :)();@] + + + + + 0 + + -19 + + + + 0 + + + + + 0 + + -20 + + + + 3 + 2 + [@template <class ErrorInfo,class E> typename ErrorInfo::value_type const * (:link + 1 + + 0 + + -20 + + + 2 + :)( E const & x );@] + + + + + 0 + + -21 + + 5 2 @@ -4490,7 +4573,7 @@ 0 - -13 + -21 2 @@ -4510,93 +4593,7 @@ 0 - -14 - - - - 0 - - - - - 0 - - -15 - - - - 0 - - - - - 0 - - -16 - - - - 0 - - - - - 0 - - -17 - - - - 0 - - - - - 0 - - -18 - - - - 0 - - - - - 0 - - -19 - - - - 5 - 2 - [@template <class E, class Tag, class T> E const & (:link - 1 - - 0 - - -19 - - - 2 - mod="/":)( E const & x, (:link - 1 - - 0 - - -31 - - - 2 - :)<Tag,T> const & v );@] - - - - - 0 - - -20 + -22 @@ -4607,64 +4604,13 @@ 0 - -20 + -22 2 :)( T const & e );@] - - - 0 - - -21 - - - - 7 - 2 - [@template <class E, class Tag1, class T1, ..., class TagN, class TN> E const & (:link - 1 - - 0 - - -21 - - - 2 - mod="/":)( E const & x, (:link http://www.boost.org/libs/tuple/doc/tuple_users_guide.html|tuple:)< (:link - 1 - - 0 - - -31 - - - 2 - :)<Tag1,T1>, ..., (:link - 1 - - 0 - - -31 - - - 2 - :)<TagN,TN> > const & v );@] - - - - - 0 - - -22 - - - - 0 - - 0 @@ -4684,9 +4630,18 @@ - 3 + 5 2 - [@(:link + [@template <class T> (:link + 1 + + 0 + + -13 + + + 2 + :) (:link 1 0 @@ -4695,7 +4650,7 @@ 2 - mod="m":)();@] + :)( T const & e );@] @@ -4706,7 +4661,36 @@ - 0 + 7 + 2 + [@template <class E, class Tag1, class T1, ..., class TagN, class TN> E const & (:link + 1 + + 0 + + -25 + + + 2 + mod="/":)( E const & x, (:link http://www.boost.org/libs/tuple/doc/tuple_users_guide.html|tuple:)< (:link + 1 + + 0 + + -35 + + + 2 + :)<Tag1,T1>, ..., (:link + 1 + + 0 + + -35 + + + 2 + :)<TagN,TN> > const & v );@] @@ -4728,27 +4712,7 @@ - 5 - 2 - [@#ifdef BOOST_NO_EXCEPTIONS void (:link - 1 - - 0 - - -27 - - - 2 - :)( std::exception const & e ); // user defined #else template <class E> void (:link - 1 - - 0 - - -27 - - - 2 - :)( E const & e ); #endif@] + 0 @@ -4759,7 +4723,18 @@ - 0 + 3 + 2 + [@(:link + 1 + + 0 + + -28 + + + 2 + mod="m":)();@] @@ -4781,18 +4756,7 @@ - 3 - 2 - [@class (:link - 1 - - 0 - - -30 - - - 2 - :);@] + 0 @@ -4803,9 +4767,9 @@ - 3 + 5 2 - [@template <class Tag,class T> class (:link + [@#ifdef BOOST_NO_EXCEPTIONS void (:link 1 0 @@ -4814,7 +4778,16 @@ 2 - :);@] + :)( std::exception const & e ); // user defined #else template <class E> void (:link + 1 + + 0 + + -31 + + + 2 + :)( E const & e ); #endif@] @@ -4824,28 +4797,6 @@ -32 - - 3 - 2 - [@typedef ---unspecified--- (:link - 1 - - 0 - - -32 - - - 2 - :);@] - - - - - 0 - - -33 - - 5 2 @@ -4854,7 +4805,7 @@ 0 - -33 + -32 2 @@ -4863,13 +4814,24 @@ 0 - -32 + -13 2 :) const & ep ); + + + 0 + + -33 + + + + 0 + + 0 @@ -4878,9 +4840,9 @@ - 5 + 3 2 - [@class (:link + [@class (:link 1 0 @@ -4889,16 +4851,7 @@ 2 - :): public std::exception public boost:: - 1 - - 0 - - -30 - - - 2 - { ---unspecified--- };@] + :);@] @@ -4909,9 +4862,9 @@ - 5 + 3 2 - [@std::string (:link + [@template <class Tag,class T> class (:link 1 0 @@ -4920,16 +4873,7 @@ 2 - :)( boost::(:link - 1 - - 0 - - -30 - - - 2 - :) const & );@] + :);@] @@ -4951,7 +4895,27 @@ - 0 + 5 + 2 + [@class (:link + 1 + + 0 + + -37 + + + 2 + :): public std::exception public boost:: + 1 + + 0 + + -34 + + + 2 + { ---unspecified--- };@] @@ -4962,7 +4926,18 @@ - 0 + 3 + 2 + [@template <class E> E * + 1 + + 0 + + -38 + + + 2 + ();@] @@ -5006,7 +4981,36 @@ - 0 + 7 + 2 + [@(:link + 1 + + 0 + + -42 + + + 2 + mod="m":)(); (:link + 1 + + 0 + + -42 + + + 2 + mod="m":)( (:link + 1 + + 0 + + -34 + + + 2 + :) const & x );@] @@ -5017,7 +5021,27 @@ - 0 + 5 + 2 + [@(:link + 1 + + 0 + + -47 + + + 2 + mod="m":) const & (:link + 1 + + 0 + + -43 + + + 2 + mod="m":)() const;@] @@ -5083,27 +5107,7 @@ - 5 - 2 - [@(:link - 1 - - 0 - - -47 - - - 2 - mod="m":) const & (:link - 1 - - 0 - - -48 - - - 2 - mod="m":)() const;@] + 0 @@ -5114,36 +5118,7 @@ - 7 - 2 - [@(:link - 1 - - 0 - - -49 - - - 2 - mod="m":)(); (:link - 1 - - 0 - - -49 - - - 2 - mod="m":)( (:link - 1 - - 0 - - -30 - - - 2 - :) const & x );@] + 0 @@ -5179,6 +5154,94 @@ 0 + + + 0 + + -53 + + + + 0 + + + + + 0 + + -54 + + + + 0 + + + + + 0 + + -55 + + + + 0 + + + + + 0 + + -56 + + + + 0 + + + + + 0 + + -57 + + + + 0 + + + + + 0 + + -58 + + + + 0 + + + + + 0 + + -59 + + + + 0 + + + + + 0 + + -60 + + + + 0 + + @@ -5186,13 +5249,13 @@ include - 56 + 64 reno_layer - 48 + 56 0 @@ -5200,108 +5263,6 @@ -5 - - 7 - 2 - (:auto !!!:) (:include synopsis:) This macro takes an exception object, records BOOST_CURRENT_FUNCTION, __FILE__ and __LINE__ in it, and forwards it to - 1 - - 0 - - -27 - - - 2 - . To recover this information at the catch site, use - 1 - - 0 - - -12 - - - 2 - ; the information is also included in the message returned by - 1 - - 0 - - -35 - - - 2 - . - - - - - 0 - - -6 - - - - 5 - 2 - (:auto !!!:) (:include synopsis:) !!!!Requirements: T must be a class with an accessible no-throw copy constructor as per (15.5.1). !!!!Returns: * If T derives from boost::(:link - 1 - - 0 - - -30 - - - 2 - :), the returned object is of type T and is a copy of x. * Otherwise, the returned object is of an unspecified type that derives publicly from both T and boost::(:link - 1 - - 0 - - -30 - - - 2 - :). The T sub-object is initialized from x by the T copy constructor. !!!!Throws: Nothing. - - - - - 0 - - -7 - - - - 5 - 2 - (:auto !!!:) (:include synopsis:) !!!!Effects: As if [@try { throw - 1 - - 0 - - -20 - - - 2 - (e); } catch(...) { return (:link - 1 - - 0 - - -8 - - - 2 - :)(); }@] - - - - - 0 - - -8 - - 29 2 @@ -5310,7 +5271,7 @@ 0 - -8 + -5 2 @@ -5319,7 +5280,7 @@ 0 - -32 + -13 2 @@ -5328,7 +5289,7 @@ 0 - -32 + -13 2 @@ -5337,7 +5298,7 @@ 0 - -8 + -5 2 @@ -5346,7 +5307,7 @@ 0 - -8 + -5 2 @@ -5355,7 +5316,7 @@ 0 - -20 + -22 2 @@ -5364,7 +5325,7 @@ 0 - -20 + -22 2 @@ -5373,7 +5334,7 @@ 0 - -8 + -5 2 @@ -5382,7 +5343,7 @@ 0 - -32 + -13 2 @@ -5391,7 +5352,7 @@ 0 - -34 + -37 2 @@ -5400,7 +5361,7 @@ 0 - -30 + -34 2 @@ -5409,7 +5370,7 @@ 0 - -30 + -34 2 @@ -5418,7 +5379,7 @@ 0 - -34 + -37 2 @@ -5427,13 +5388,250 @@ 0 - -30 + -34 2 :) copy constructor. + + + 0 + + -6 + + + + 29 + 2 + (:auto !!!:) (:include synopsis:) !!!!Returns: A string value that contains varying amount of implementation-specific diagnostic information about the passed exception object: *If E can be statically converted to boost::(:link + 1 + + 0 + + -34 + + + 2 + :), the returned value contains the string representations of all (:link + 1 + + 0 + + -35 + + + 2 + :) objects stored in the boost::(:link + 1 + + 0 + + -34 + + + 2 + :) through (:link + 1 + + 0 + + -15 + + + 2 + mod="/":), along with other diagnostic information relevant to the exception. If e can be dynamically converted to std::exception, the returned value also contains the what() string. *Otherwise, if E can be statically converted std::exception: **if e can be dynamically converted to boost::exception, the returned value is the same as if E could be statically converted to boost::(:link + 1 + + 0 + + -34 + + + 2 + :); **otherwise the returned value contains the what() string. *Otherwise, the boost:: + 1 + + 0 + + -6 + + + 2 + template is not available. The string representation of each (:link + 1 + + 0 + + -35 + + + 2 + :) object is deduced by a function call that is bound at the time the (:link + 1 + + 0 + + -35 + + + 2 + :)<Tag,T> template is instantiated. The following overload resolutions are attempted in order: #Unqualified call to to_string(x), where x is of type (:link + 1 + + 0 + + -35 + + + 2 + :)<Tag,T> (the return value is expected to be of type std::string.) #Unqualified call to to_string(x.(:link + 1 + + 0 + + -43 + + + 2 + mod="m":)()) (the return value is expected to be of type std::string.) #Unqualified call to s << x.(:link + 1 + + 0 + + -43 + + + 2 + mod="m":)(), where s is a std::ostringstream. The first successfully bound function is used at the time (:link + 1 + + 0 + + -6 + + + 2 + :) is called; if all 3 overload resolutions are unsuccessful, the system is unable to convert the (:link + 1 + + 0 + + -35 + + + 2 + :) object to string, and ''an unspecified stub string value is used without issuing a compile error.'' !!!!Notes: *The format of the returned string is unspecified. *The returned string is ''not'' user-friendly. *The returned string may include additional platform-specific diagnostic information. (:include + 1 + + 0 + + -58 + + + 2 + :) + + + + + 0 + + -7 + + + + 7 + 2 + (:auto !!!:) (:include synopsis:) This macro takes an exception object, records BOOST_CURRENT_FUNCTION, __FILE__ and __LINE__ in it, and forwards it to + 1 + + 0 + + -31 + + + 2 + . To recover this information at the catch site, use + 1 + + 0 + + -20 + + + 2 + ; the information is also included in the message returned by + 1 + + 0 + + -6 + + + 2 + . + + + + + 0 + + -8 + + + + 11 + 2 + (:auto !!:) All exception types that derive from boost::(:link + 1 + + 0 + + -34 + + + 2 + :) can be used as type-safe containers of arbitrary data objects, while complying with the no-throw requirements (15.5.1) of the ANSI C++ standard for exception types. When exceptions derive from boost::(:link + 1 + + 0 + + -34 + + + 2 + :), arbitrary data can be added to exception objects: *At the point of the throw; *At a later time as exceptions bubble up the call stack. (:include + 1 + + 0 + + -57 + + + 2 + :) (:include + 1 + + 0 + + -40 + + + 2 + :) (:include + 1 + + 0 + + -59 + + + 2 + :) + + 0 @@ -5441,6 +5639,203 @@ -9 + + 33 + 2 + (:auto !!!:) Traditionally, when using exceptions to report failures, the throw site: *creates an exception object of the appropriate type, and *stuffs it with data relevant to the detected error. A higher context in the program contains a catch statement which: *selects failures based on exception types, and *inspects exception objects for data required to deal with the problem. The main issue with this "traditional" approach is that often, the data available at the point of the throw is insufficient for the catch site to handle the failure. Here is an example of a catch statement: [@catch( file_read_error & e ) { std::cerr << e.file_name(); }@] And here is a possible matching throw: [@void read_file( FILE * f ) { .... size_t nr=fread(buf,1,count,f); if( ferror(f) ) throw file_read_error(???); .... }@] Clearly, the problem is that the handler requires a file name but the read_file function does not have a file name to put in the exception object; all it has is a FILE pointer! In an attempt to deal with this problem, we could modify read_file to accept a file name: [@void read_file( FILE * f, char const * name ) { .... size_t nr=fread(buf,1,count,f); if( ferror(f) ) throw file_read_error(name); .... }@] This is not a real solution: it simply shifts the burden of supplying a file name to the immediate caller of the read_file function. ->''In general, the data required to handle a given library-emitted exception depends on the program that links to it. Many contexts between the throw and the catch may have relevant information which must be transported to the exception handler.'' !!!Exception wrapping The idea of exception wrapping is to catch an exception from a lower level function (such as the read_file function above), and throw a new exception object that contains the original exception (and also carries a file name.) This method seems to be particularly popular with C++ programmers with Java background. Exception wrapping leads to the following problems: *To wrap an exception object it must be copied, which may result in slicing. *Wrapping is practically impossible to use in generic contexts. The second point is actually special case of violating the exception neutrality principle. Most contexts in a program can not handle exceptions; such contexts should not interfere with the process of exception handling. !!!The boost::exception solution *Simply derive your exception types from boost::(:link + 1 + + 0 + + -34 + + + 2 + :). *Confidently limit the throw site to provide only data that is available naturally. *Use exception-neutral contexts between the throw and the catch to augment exceptions with more relevant data as they bubble up. For example, in the throw statement below we only add the errno code, since this is the only failure-relevant information available in this context: [@struct exception_base: virtual std::exception, virtual boost::(:link + 1 + + 0 + + -34 + + + 2 + :) { }; struct io_error: virtual exception_base { }; struct file_read_error: virtual io_error { }; typedef boost::(:link + 1 + + 0 + + -35 + + + 2 + :)<struct tag_errno_code,int> errno_code; void read_file( FILE * f ) { .... size_t nr=fread(buf,1,count,f); if( ferror(f) ) throw file_read_error() (:link + 1 + + 0 + + -15 + + + 2 + |<<:) errno_code(errno); .... }@] In a higher exception-neutral context, we add the file name to ''any'' exception that derives from boost::(:link + 1 + + 0 + + -34 + + + 2 + :): [@typedef boost::(:link + 1 + + 0 + + -35 + + + 2 + :)<struct tag_file_name,std::string> file_name; .... try { if( FILE * fp=fopen("foo.txt","rt") ) { shared_ptr<FILE> f(fp,fclose); .... read_file(fp); //throws types deriving from boost::(:link + 1 + + 0 + + -34 + + + 2 + :) do_something(); .... } else throw file_open_error() (:link + 1 + + 0 + + -15 + + + 2 + |<<:) errno_code(errno); } catch( boost::(:link + 1 + + 0 + + -34 + + + 2 + :) & e ) { e (:link + 1 + + 0 + + -15 + + + 2 + |<<:) file_name("foo.txt"); throw; }@] Finally here is how the handler retrieves data from exceptions that derive from boost::(:link + 1 + + 0 + + -34 + + + 2 + :): [@catch( io_error & e ) { std::cerr << "I/O Error!\n"; if( shared_ptr<std::string const> fn=(:link + 1 + + 0 + + -20 + + + 2 + :)<file_name>(e) ) std::cerr << "File name: " << *fn << "\n"; if( shared_ptr<int const> c=(:link + 1 + + 0 + + -20 + + + 2 + :)<errno_code>(e) ) std::cerr << "OS says: " << strerror(*c) << "\n"; }@] In addition, boost::(:link + 1 + + 0 + + -6 + + + 2 + :) can be used to compose an automatic (if not user-friendly) message that contains all of the (:link + 1 + + 0 + + -35 + + + 2 + :) objects added to a boost::(:link + 1 + + 0 + + -34 + + + 2 + :). This is useful for inclusion in logs and other diagnostic objects. + + + + + 0 + + -10 + + + + 7 + 2 + (:auto !!!:) Deriving from boost::(:link + 1 + + 0 + + -34 + + + 2 + :) effectively decouples the semantics of a failure from the information that is relevant to each individual instance of reporting a failure with a given semantic. In other words: with boost::(:link + 1 + + 0 + + -34 + + + 2 + :), what data a given exception object transports depends primarily on the context in which failures are reported (not on its type.) Since exception types need no members, it becomes very natural to throw exceptions that derive from more than one type to indicate multiple appropriate semantics: [@struct exception_base: virtual std::exception, virtual boost::(:link + 1 + + 0 + + -34 + + + 2 + :) { }; struct io_error: virtual exception_base { }; struct file_error: virtual io_error { }; struct read_error: virtual io_error { }; struct file_read_error: virtual file_error, virtual read_error { };@] Using this approach, exception types become a simple tagging system for categorizing errors and selecting failures in exception handlers. + + + + + 0 + + -11 + + 27 2 @@ -5449,7 +5844,7 @@ 0 - -30 + -34 2 @@ -5458,7 +5853,7 @@ 0 - -6 + -14 2 @@ -5467,7 +5862,7 @@ 0 - -30 + -34 2 @@ -5476,7 +5871,7 @@ 0 - -37 + -46 2 @@ -5485,7 +5880,7 @@ 0 - -31 + -35 2 @@ -5494,7 +5889,7 @@ 0 - -31 + -35 2 @@ -5503,7 +5898,7 @@ 0 - -31 + -35 2 @@ -5512,7 +5907,7 @@ 0 - -6 + -14 2 @@ -5521,7 +5916,7 @@ 0 - -6 + -14 2 @@ -5530,7 +5925,7 @@ 0 - -30 + -34 2 @@ -5539,7 +5934,7 @@ 0 - -19 + -15 2 @@ -5548,7 +5943,7 @@ 0 - -30 + -34 2 @@ -5557,7 +5952,7 @@ 0 - -15 + -8 2 @@ -5568,7 +5963,647 @@ 0 - -10 + -12 + + + + 57 + 2 + (:auto !!!:) !!!Why use operator<< overload for adding info to exceptions? Before throwing an object of type that derives from boost::(:link + 1 + + 0 + + -34 + + + 2 + :), it is often desirable to add one or more (:link + 1 + + 0 + + -35 + + + 2 + :) objects in it. The syntactic sugar provided by (:link + 1 + + 0 + + -15 + + + 2 + :) allows this to be done directly in a throw expression: [@throw error() (:link + 1 + + 0 + + -15 + + + 2 + |<<:) foo_info(foo) (:link + 1 + + 0 + + -15 + + + 2 + |<<:) bar_info(bar);@] which saves typing compared to this possible alternative: [@error e; e.add(foo_info(foo)); e.add(bar_info(bar)); throw e;@] and looks better than something like: [@throw error().add(foo_info(foo)).add(bar_info(bar));@] !!!Why is boost::exception abstract? To prevent exception-neutral contexts from erroneously erasing the type of the original exception when adding (:link + 1 + + 0 + + -35 + + + 2 + :) to an active exception object: [@catch( boost::(:link + 1 + + 0 + + -34 + + + 2 + :) & e ) { e (:link + 1 + + 0 + + -15 + + + 2 + |<<:) foo_info(foo); throw e; //Compile error: boost::(:link + 1 + + 0 + + -34 + + + 2 + :) is abstract }@] The correct code is: [@catch( boost::(:link + 1 + + 0 + + -34 + + + 2 + :) & e ) { e (:link + 1 + + 0 + + -15 + + + 2 + |<<:) foo_info(foo); throw; //Okay, re-throwing the original exception object. }@] !!!Why doesn't boost::exception derive from std::exception? Despite that (:link + 1 + + 0 + + -33 + + + 2 + |virtual inheritance should be used in deriving from base exception types:), many programmers fail to follow this principle when deriving from std::exception. If boost::(:link + 1 + + 0 + + -34 + + + 2 + :) derives from std::exception, using the + 1 + + 0 + + -14 + + + 2 + function with such user-defined types would introduce dangerous ambiguity which would break all catch(std::exception &) statements. Of course, boost::(:link + 1 + + 0 + + -34 + + + 2 + :) should not be used to replace std::exception as a base type in exception type hierarchies. Instead, it should be included as a virtual base, in addition to std::exception (which should also be derived virtually.) !!!What is the space overhead of the boost::exception base class? The space overhead for the boost::exception data members is negligible in the context of exception handling. Throwing objects that derive from boost::(:link + 1 + + 0 + + -34 + + + 2 + :) does not by itself cause dynamic memory allocations. Deriving from boost::(:link + 1 + + 0 + + -34 + + + 2 + :) enables any data to be added to exceptions, which usually does allocate memory. However, this memory is reclaimed when the exception has been handled, and since typically user code does not allocate memory during the unrolling of the stack, adding error info to exceptions should not cause memory fragmentation. !!!Why is boost::exception integrated in boost::throw_exception? The boost::(:link + 1 + + 0 + + -31 + + + 2 + :) function predates the Boost Exception library and there has been some concern about its current behavior of injecting boost::(:link + 1 + + 0 + + -34 + + + 2 + :) as a base of any exception passed to boost::(:link + 1 + + 0 + + -31 + + + 2 + :). Such concerns are dictated by the typical strict interpretation of a common principle in C and C++, that users only pay for features they actually use. The problem is that users of Boost Exception can't by themselves cause a library to throw types that derive from boost::(:link + 1 + + 0 + + -34 + + + 2 + :), and without this they can't use any of the Boost Exception facilities. For example, if a user wants to use Boost Serialization in a separate thread, it is desirable to be able to transport exceptions emitted by that library into the main thread where they can be analyzed to generate a user-friendly message. This can be easily achieved using boost::(:link + 1 + + 0 + + -13 + + + 2 + :), but this requires that Boost Serialization throws exceptions using boost::(:link + 1 + + 0 + + -22 + + + 2 + :). If Boost Serialization calls boost::(:link + 1 + + 0 + + -31 + + + 2 + :) to throw, this behavior happens automatically and transparently. The cost of this integration is: * In terms of space: a pointer and 3 ints are added to the static size of exception objects. * In terms of speed: the pointer is initialized to null at the point of the throw. * In terms of coupling: about 400 self-contained lines of C++ with no external includes. !!!Should I call boost::throw_exception or BOOST_THROW_EXCEPTION? It is preferable to throw exceptions using the (:link + 1 + + 0 + + -7 + + + 2 + :) macro. This has the benefit of recording in the exception object the __FILE__ and __LINE__ of the throw, as well as the pretty name of the function that throws. This has virtually no overhead, yet enables boost::(:link + 1 + + 0 + + -6 + + + 2 + :) to compose a more useful, if not user-friendly message. Typical use of boost::(:link + 1 + + 0 + + -6 + + + 2 + :) is: [@catch( boost::exception & e ) { std::cerr << "OMG!" << boost::diagnostic_information(e); } catch( ... ) { std::cerr << "OMG!!!"; }@] This is a possible message it may display, the first line is only possible if (:link + 1 + + 0 + + -7 + + + 2 + :) is used: [@example_io.cpp(83): Throw in function void parse_file(const char *) Dynamic exception type: class file_open_error std::exception::what: example_io error [struct tag_errno_code *] = 2, OS says "No such file or directory" [struct tag_file_name *] = tmp1.xml [struct tag_function *] = fopen [struct tag_open_mode *] = rb@] + + + + + 0 + + -13 + + + + 17 + 2 + (:auto !!!:) (:include synopsis:) The (:link + 1 + + 0 + + -13 + + + 2 + :) type can be used to refer to a copy of an exception object. It is Default Constructible, Copy Constructible, Assignable and Equality Comparable; (:link + 1 + + 0 + + -13 + + + 2 + :)'s operations do not throw. Two instances of (:link + 1 + + 0 + + -13 + + + 2 + :) are equivalent and compare equal if and only if they refer to the same exception. The default constructor of (:link + 1 + + 0 + + -13 + + + 2 + :) produces the null value of the type. The null value is equivalent only to itself. !!!!Thread safety * It is legal for multiple threads to hold (:link + 1 + + 0 + + -13 + + + 2 + :) references to the same exception object. * It is illegal for multiple threads to modify the same (:link + 1 + + 0 + + -13 + + + 2 + :) object concurrently. * While calling (:link + 1 + + 0 + + -5 + + + 2 + :) makes a copy of the current exception object, it is still possible for the two copies to share internal state. Therefore, in general it is not safe to call (:link + 1 + + 0 + + -32 + + + 2 + :) concurrently to throw the same exception object into multiple threads. + + + + + 0 + + -14 + + + + 5 + 2 + (:auto !!!:) (:include synopsis:) !!!!Requirements: T must be a class with an accessible no-throw copy constructor as per (15.5.1). !!!!Returns: * If T derives from boost::(:link + 1 + + 0 + + -34 + + + 2 + :), the returned object is of type T and is a copy of x. * Otherwise, the returned object is of an unspecified type that derives publicly from both T and boost::(:link + 1 + + 0 + + -34 + + + 2 + :). The T sub-object is initialized from x by the T copy constructor. !!!!Throws: Nothing. + + + + + 0 + + -15 + + + + 7 + 2 + (:auto !!!:) (:include synopsis:) !!!!Requirements: E must be boost::(:link + 1 + + 0 + + -34 + + + 2 + :), or a type that derives (indirectly) from boost::(:link + 1 + + 0 + + -34 + + + 2 + :). !!!!Effects: Stores a copy of v into x. If x already contains data of type (:link + 1 + + 0 + + -35 + + + 2 + :)<Tag,T>, that data is overwritten. !!!!Returns: x. (:include throws:) + + + + + 0 + + -16 + + + + 15 + 2 + (:auto !!:) Boost Exception responds to the following configuration macros: '''BOOST_NO_RTTI'''\\ '''BOOST_NO_TYPEID''' The first macro prevents Boost Exception from using dynamic_cast and dynamic typeid. If the second macro is also defined, Boost Exception does not use static typeid either. There are no observable degrading effects on the library functionality, except for the following: ->By default, the (:link + 1 + + 0 + + -20 + + + 2 + :) function template can be called with any exception type. If BOOST_NO_RTTI is defined, (:link + 1 + + 0 + + -20 + + + 2 + :) can be used only with objects of type boost::(:link + 1 + + 0 + + -34 + + + 2 + :). !!!!Note: The library needs RTTI functionality. Disabling the language RTTI support enables an internal RTTI system, which may have more or less overhead depending on the platform. '''BOOST_EXCEPTION_DISABLE''' By default, (:link + 1 + + 0 + + -22 + + + 2 + :) and (:link + 1 + + 0 + + -14 + + + 2 + :) are integrated directly in the (:link + 1 + + 0 + + -31 + + + 2 + :) function. Defining BOOST_EXCEPTION_DISABLE disables this integration. Note that on some non-conformant compilers, for example MSVC 7.0 and older, as well as BCC, BOOST_EXCEPTION_DISABLE is implicitly defined in (:link + 1 + + 0 + + -54 + + + 2 + :). + + + + + 0 + + -17 + + + + 19 + 2 + (:auto !!:) Boost Exception provides a namespace-scope function (:link + 1 + + 0 + + -6 + + + 2 + :) which takes a boost::(:link + 1 + + 0 + + -34 + + + 2 + :). The returned string contains: *the string representation of all data objects added to the boost::(:link + 1 + + 0 + + -34 + + + 2 + :) through (:link + 1 + + 0 + + -15 + + + 2 + mod="/":); *the output from std::exception::what; *additional platform-specific diagnostic information. The returned string is not presentable as a friendly user message, but because it is generated automatically, it is useful for debugging or logging purposes. Here is an example: [@#include <(:link + 1 + + 0 + + -46 + + + 2 + :)> #include <iostream> void f(); //throws unknown types that derive from boost::(:link + 1 + + 0 + + -34 + + + 2 + :). void g() { try { f(); } catch( boost::(:link + 1 + + 0 + + -34 + + + 2 + :) & e ) { std::cerr << (:link + 1 + + 0 + + -6 + + + 2 + :)(e); } }@] (:include + 1 + + 0 + + -58 + + + 2 + :) + + + + + 0 + + -18 + + + + 9 + 2 + (:auto !!!:) (:include synopsis:) !!!!Requirements: This function must not be called outside of a catch block. !!!!Returns: If the current exception object can be converted to boost::(:link + 1 + + 0 + + -34 + + + 2 + :) or std::exception, this function returns the same string value returned by (:link + 1 + + 0 + + -6 + + + 2 + :) for the current exception object. Otherwise, an unspecified non-empty string is returned. Typical use is to call + 1 + + 0 + + -18 + + + 2 + from a top-level function to output diagnostic information about unhandled exceptions: [@int main() { try { run_program(); } catch( error & e ) { //handle error } catch( ...) { std::cerr << "Unhandled exception!" << std::endl << boost:: + 1 + + 0 + + -18 + + + 2 + (); } }@] + + + + + 0 + + -19 @@ -5581,101 +6616,7 @@ 0 - -11 - - - - 19 - 2 - (:auto !!!:) Sometimes the throw site does not have all the information that is needed at the catch site to make sense of what went wrong. Let's say we have an exception type file_read_error, which takes a file name in its constructor. Consider the following function: [@void file_read( FILE * f, void * buffer, size_t size ) { if( size!=fread(buffer,1,size,f) ) throw file_read_error(????); }@] How can the file_read function pass a file name to the exception type constructor? All it has is a FILE handle. Using boost:: - 1 - - 0 - - -30 - - - 2 - allows us to free the file_read function from the burden of storing the file name in exceptions it throws: [@#include <(:link - 1 - - 0 - - -37 - - - 2 - :)> #include <stdio.h> #include <errno.h> typedef boost::(:link - 1 - - 0 - - -31 - - - 2 - :)<struct tag_errno,int> errno_info; class file_read_error: public boost::(:link - 1 - - 0 - - -30 - - - 2 - :) { }; void file_read( FILE * f, void * buffer, size_t size ) { if( size!=fread(buffer,1,size,f) ) throw file_read_error() << errno_info(errno); }@] If file_read detects a failure, it throws an exception which contains the information that is available at the time, namely the errno. Other relevant information, such as the file name, can be added in a context higher up the call stack, where it is known naturally: [@#include <(:link - 1 - - 0 - - -37 - - - 2 - :)> #include <boost/shared_ptr.hpp> #include <stdio.h> #include <string> typedef boost::(:link - 1 - - 0 - - -31 - - - 2 - :)<struct tag_file_name,std::string> file_name_info; boost::shared_ptr<FILE> file_open( char const * file_name, char const * mode ); void file_read( FILE * f, void * buffer, size_t size ); void parse_file( char const * file_name ) { boost::shared_ptr<FILE> f = file_open(file_name,"rb"); assert(f); try { char buf[1024]; file_read( f.get(), buf, sizeof(buf) ); } catch( boost::(:link - 1 - - 0 - - -30 - - - 2 - :) & e ) { e << file_name_info(file_name); throw; } }@] The above function is (almost) exception-neutral -- if an exception is emitted by any function call within the try block, parse_file does not need to do any real work, but it intercepts any boost::(:link - 1 - - 0 - - -30 - - - 2 - :) object, stores the file name, and re-throws using a throw-expression with no operand (15.1.6). The rationale for catching any boost::(:link - 1 - - 0 - - -30 - - - 2 - :) object is that the file name is relevant to any failure that occurs in parse_file, ''even if the failure is unrelated to file I/O''. - - - - - 0 - - -12 + -20 @@ -5686,43 +6627,43 @@ 0 - -31 + -35 2 - :) template. * E must be polymorphic. * The (:link + :) template. * E must be polymorphic. !!!!Returns: * If dynamic_cast<boost::(:link 1 0 - -12 + -34 2 - :) function must not be called outside of a catch block. !!!!Returns: * If dynamic_cast<boost::(:link + :) const *>(&x) is 0, or if x does not store an object of type ErrorInfo, the returned value is null. * Otherwise, the returned pointer points to the stored value (use (:link 1 0 - -30 + -15 2 - :) const *>(&x) is 0, or if x does not store an object of type ErrorInfo, the returned value is an empty shared_ptr. * Otherwise, the returned shared_ptr points to the stored value (use (:link + mod="/":) to store values in exception objects.) When x is destroyed, any pointers returned by (:link 1 0 - -19 + -20 2 - mod="/":) to store values in exception objects.) The shared_ptr is valid even after x has been destroyed. !!!!Throws: Nothing. !!!!Note: The interface of (:link + :) become invalid. !!!!Throws: Nothing. !!!!Note: The interface of (:link 1 0 - -12 + -20 2 @@ -5731,7 +6672,7 @@ 0 - -36 + -16 2 @@ -5742,7 +6683,7 @@ 0 - -13 + -21 @@ -5753,7 +6694,7 @@ 0 - -31 + -35 2 @@ -5764,742 +6705,7 @@ 0 - -14 - - - - 37 - 2 - (:auto !!!:) When you catch an exception, you can call (:link - 1 - - 0 - - -8 - - - 2 - :) to get an (:link - 1 - - 0 - - -32 - - - 2 - :) object: [@#include <(:link - 1 - - 0 - - -43 - - - 2 - :)> #include <boost/thread.hpp> #include <boost/bind.hpp> void do_work(); //throws cloning-enabled boost::(:link - 1 - - 0 - - -30 - - - 2 - :)s void worker_thread( boost::(:link - 1 - - 0 - - -32 - - - 2 - :) & error ) { try { do_work(); error = boost::(:link - 1 - - 0 - - -32 - - - 2 - :)(); } catch( ... ) { error = boost::(:link - 1 - - 0 - - -8 - - - 2 - :)(); } }@] In the above example, note that (:link - 1 - - 0 - - -8 - - - 2 - :) captures the original type of the exception object. The exception can be thrown again using the (:link - 1 - - 0 - - -33 - - - 2 - :) function: [@// ...continued void work() { boost::(:link - 1 - - 0 - - -32 - - - 2 - :) error; boost::(:link http://www.boost.org/doc/html/boost/thread.html|thread:) t( boost::(:link http://www.boost.org/libs/bind/bind.html|bind:)(worker_thread,boost::(:link http://www.boost.org/doc/html/ref.html|ref:)(error)) ); t.(:link http://www.boost.org/doc/html/boost/thread.html|join:)(); if( error ) boost::(:link - 1 - - 0 - - -33 - - - 2 - :)(error); }@] Note that (:link - 1 - - 0 - - -8 - - - 2 - :) could fail to copy the original exception object in the following cases: * if there is not enough memory, in which case the returned (:link - 1 - - 0 - - -32 - - - 2 - :) points to an instance of std::bad_alloc, or * if (:link - 1 - - 0 - - -20 - - - 2 - :) was not used in the throw-expression passed to the original throw statement and the current implementation does not have the necessary compiler-specific support to copy the exception automatically, in which case the returned (:link - 1 - - 0 - - -32 - - - 2 - :) points to an instance of (:link - 1 - - 0 - - -34 - - - 2 - :). Regardless, the use of (:link - 1 - - 0 - - -8 - - - 2 - :) and (:link - 1 - - 0 - - -33 - - - 2 - :) in the above examples is well-formed. - - - - - 0 - - -15 - - - - 11 - 2 - (:auto !!:) All exception types that derive from boost::(:link - 1 - - 0 - - -30 - - - 2 - :) can be used as type-safe containers of arbitrary data objects, while complying with the no-throw requirements (15.5.1) of the ANSI C++ standard for exception types. When exceptions derive from boost::(:link - 1 - - 0 - - -30 - - - 2 - :), arbitrary data can be added to exception objects: *At the point of the throw; *At a later time as exceptions bubble up the call stack. (:include - 1 - - 0 - - -46 - - - 2 - :) (:include - 1 - - 0 - - -11 - - - 2 - :) (:include - 1 - - 0 - - -50 - - - 2 - :) - - - - - 0 - - -16 - - - - 33 - 2 - (:auto !!!:) Traditionally, when using exceptions to report failures, the throw site: *creates an exception object of the appropriate type, and *stuffs it with data relevant to the detected error. A higher context in the program contains a catch statement which: *selects failures based on exception types, and *inspects exception objects for data required to deal with the problem. The main issue with this "traditional" approach is that often, the data available at the point of the throw is insufficient for the catch site to handle the failure. Here is an example of a catch statement: [@catch( file_read_error & e ) { std::cerr << e.file_name(); }@] And here is a possible matching throw: [@void read_file( FILE * f ) { .... size_t nr=fread(buf,1,count,f); if( ferror(f) ) throw file_read_error(???); .... }@] Clearly, the problem is that the handler requires a file name but the read_file function does not have a file name to put in the exception object; all it has is a FILE pointer! In an attempt to deal with this problem, we could modify read_file to accept a file name: [@void read_file( FILE * f, char const * name ) { .... size_t nr=fread(buf,1,count,f); if( ferror(f) ) throw file_read_error(name); .... }@] This is not a real solution: it simply shifts the burden of supplying a file name to the immediate caller of the read_file function. ->''In general, the data required to handle a given library-emitted exception depends on the program that links to it. Many contexts between the throw and the catch may have relevant information which must be transported to the exception handler.'' !!!Exception wrapping The idea of exception wrapping is to catch an exception from a lower level function (such as the read_file function above), and throw a new exception object that contains the original exception (and also carries a file name.) This method seems to be particularly popular with C++ programmers with Java background. Exception wrapping leads to the following problems: *To wrap an exception object it must be copied, which may result in slicing. *Wrapping is practically impossible to use in generic contexts. The second point is actually special case of violating the exception neutrality principle. Most contexts in a program can not handle exceptions; such contexts should not interfere with the process of exception handling. !!!The boost::exception solution *Simply derive your exception types from boost::(:link - 1 - - 0 - - -30 - - - 2 - :). *Confidently limit the throw site to provide only data that is available naturally. *Use exception-neutral contexts between the throw and the catch to augment exceptions with more relevant data as they bubble up. For example, in the throw statement below we only add the errno code, since this is the only failure-relevant information available in this context: [@struct exception_base: virtual std::exception, virtual boost::(:link - 1 - - 0 - - -30 - - - 2 - :) { }; struct io_error: virtual exception_base { }; struct file_read_error: virtual io_error { }; typedef boost::(:link - 1 - - 0 - - -31 - - - 2 - :)<struct tag_errno_code,int> errno_code; void read_file( FILE * f ) { .... size_t nr=fread(buf,1,count,f); if( ferror(f) ) throw file_read_error() (:link - 1 - - 0 - - -19 - - - 2 - |<<:) errno_code(errno); .... }@] In a higher exception-neutral context, we add the file name to ''any'' exception that derives from boost::(:link - 1 - - 0 - - -30 - - - 2 - :): [@typedef boost::(:link - 1 - - 0 - - -31 - - - 2 - :)<struct tag_file_name,std::string> file_name; .... try { if( FILE * fp=fopen("foo.txt","rt") ) { shared_ptr<FILE> f(fp,fclose); .... read_file(fp); //throws types deriving from boost::(:link - 1 - - 0 - - -30 - - - 2 - :) do_something(); .... } else throw file_open_error() (:link - 1 - - 0 - - -19 - - - 2 - |<<:) errno_code(errno); } catch( boost::(:link - 1 - - 0 - - -30 - - - 2 - :) & e ) { e (:link - 1 - - 0 - - -19 - - - 2 - |<<:) file_name("foo.txt"); throw; }@] Finally here is how the handler retreives data from exceptions that derive from boost::(:link - 1 - - 0 - - -30 - - - 2 - :): [@catch( io_error & e ) { std::cerr << "I/O Error!\n"; if( shared_ptr<std::string const> fn=(:link - 1 - - 0 - - -12 - - - 2 - :)<file_name>(e) ) std::cerr << "File name: " << *fn << "\n"; if( shared_ptr<int const> c=(:link - 1 - - 0 - - -12 - - - 2 - :)<errno_code>(e) ) std::cerr << "OS says: " << strerror(*c) << "\n"; }@] In addition, boost::(:link - 1 - - 0 - - -35 - - - 2 - :) can be used to compose an automatic (if not user-friendly) message that contains all of the (:link - 1 - - 0 - - -31 - - - 2 - :) objects added to a boost::(:link - 1 - - 0 - - -30 - - - 2 - :). This is useful for inclusion in logs and other diagnostic objects. - - - - - 0 - - -17 - - - - 7 - 2 - (:auto !!!:) Deriving from boost::(:link - 1 - - 0 - - -30 - - - 2 - :) effectively decouples the semantics of a failure from the information that is relevant to each individual instance of reporting a failure with a given semantic. In other words: with boost::(:link - 1 - - 0 - - -30 - - - 2 - :), what data a given exception object transports depends primarily on the context in which failures are reported (not on its type.) Since exception types need no members, it becomes very natural to throw exceptions that derive from more than one type to indicate multiple appropriate semantics: [@struct exception_base: virtual std::exception, virtual boost::(:link - 1 - - 0 - - -30 - - - 2 - :) { }; struct io_error: virtual exception_base { }; struct file_error: virtual io_error { }; struct read_error: virtual io_error { }; struct file_read_error: virtual file_error, virtual read_error { };@] Using this approach, exception types become a simple tagging system for categorizing errors and selecting failures in exception handlers. - - - - - 0 - - -18 - - - - 57 - 2 - (:auto !!!:) !!!Why use operator<< overload for adding info to exceptions? Before throwing an object of type that derives from boost::(:link - 1 - - 0 - - -30 - - - 2 - :), it is often desirable to add one or more (:link - 1 - - 0 - - -31 - - - 2 - :) objects in it. The syntactic sugar provided by (:link - 1 - - 0 - - -19 - - - 2 - :) allows this to be done directly in a throw expression: [@throw error() (:link - 1 - - 0 - - -19 - - - 2 - |<<:) foo_info(foo) (:link - 1 - - 0 - - -19 - - - 2 - |<<:) bar_info(bar);@] which saves typing compared to this possible alternative: [@error e; e.add(foo_info(foo)); e.add(bar_info(bar)); throw e;@] and looks better than something like: [@throw error().add(foo_info(foo)).add(bar_info(bar));@] !!!Why is boost::exception abstract? To prevent exception-neutral contexts from erroneously erasing the type of the original exception when adding (:link - 1 - - 0 - - -31 - - - 2 - :) to an active exception object: [@catch( boost::(:link - 1 - - 0 - - -30 - - - 2 - :) & e ) { e (:link - 1 - - 0 - - -19 - - - 2 - |<<:) foo_info(foo); throw e; //Compile error: boost::(:link - 1 - - 0 - - -30 - - - 2 - :) is abstract }@] The correct code is: [@catch( boost::(:link - 1 - - 0 - - -30 - - - 2 - :) & e ) { e (:link - 1 - - 0 - - -19 - - - 2 - |<<:) foo_info(foo); throw; //Okay, re-throwing the original exception object. }@] !!!Why doesn't boost::exception derive from std::exception? Despite that (:link - 1 - - 0 - - -29 - - - 2 - |virtual inheritance should be used in deriving from base exception types:), many programmers fail to follow this principle when deriving from std::exception. If boost::(:link - 1 - - 0 - - -30 - - - 2 - :) derives from std::exception, using the - 1 - - 0 - - -6 - - - 2 - function with such user-defined types would introduce dangerous ambiguity which would break all catch(std::exception &) statements. Of course, boost::(:link - 1 - - 0 - - -30 - - - 2 - :) should not be used to replace std::exception as a base type in exception type hierarchies. Instead, it should be included as a virtual base, in addition to std::exception (which should also be derived virtually.) !!!What is the space overhead of the boost::exception base class? The space overhead for the boost::exception data members is negligible in the context of exception handling. Throwing objects that derive from boost::(:link - 1 - - 0 - - -30 - - - 2 - :) does not by itself cause dynamic memory allocations. Deriving from boost::(:link - 1 - - 0 - - -30 - - - 2 - :) enables any data to be added to exceptions, which usually does allocate memory. However, this memory is reclaimed when the exception has been handled, and since typically user code does not allocate memory during the unrolling of the stack, adding error info to exceptions should not cause memory fragmentation. !!!Why is boost::exception integrated in boost::throw_exception? The boost::(:link - 1 - - 0 - - -27 - - - 2 - :) function predates the Boost Exception library and there has been some concern about its current behavior of injecting boost::(:link - 1 - - 0 - - -30 - - - 2 - :) as a base of any exception passed to boost::(:link - 1 - - 0 - - -27 - - - 2 - :). Such concerns are dictated by the typical strict interpretation of a common principle in C and C++, that users only pay for features they actually use. The problem is that users of Boost Exception can't by themselves cause a library to throw types that derive from boost::(:link - 1 - - 0 - - -30 - - - 2 - :), and without this they can't use any of the Boost Exception facilities. For example, if a user wants to use Boost Serialization in a separate thread, it is desirable to be able to transport exceptions emitted by that library into the main thread where they can be analyzed to generate a user-friendly message. This can be easily achieved using boost::(:link - 1 - - 0 - - -32 - - - 2 - :), but this requires that Boost Serialization throws exceptions using boost::(:link - 1 - - 0 - - -20 - - - 2 - :). If Boost Serialization calls boost::(:link - 1 - - 0 - - -27 - - - 2 - :) to throw, this behavior happens automatically and transparently. The cost of this integration is: * In terms of space: a pointer and 3 ints are added to the static size of exception objects. * In terms of speed: the pointer is initialized to null at the point of the throw. * In terms of coupling: about 400 self-contained lines of C++ with no external includes. !!!Should I call boost::throw_exception or BOOST_THROW_EXCEPTION? It is preferable to throw exceptions using the (:link - 1 - - 0 - - -5 - - - 2 - :) macro. This has the benefit of recording in the exception object the __FILE__ and __LINE__ of the throw, as well as the pretty name of the function that throws. This has virtually no overhead, yet enables boost::(:link - 1 - - 0 - - -35 - - - 2 - :) to compose a more useful, if not user-friendly message. Typical use of boost::(:link - 1 - - 0 - - -35 - - - 2 - :) is: [@catch( boost::exception & e ) { std::cerr << "OMG!" << boost::diagnostic_information(e); } catch( ... ) { std::cerr << "OMG!!!"; }@] This is a possible message it may display, the first line is only possible if (:link - 1 - - 0 - - -5 - - - 2 - :) is used: [@example_io.cpp(83): Throw in function void parse_file(const char *) Dynamic exception type: class file_open_error std::exception::what: example_io error [struct tag_errno_code *] = 2, OS says "No such file or directory" [struct tag_file_name *] = tmp1.xml [struct tag_function *] = fopen [struct tag_open_mode *] = rb@] - - - - - 0 - - -19 - - - - 7 - 2 - (:auto !!!:) (:include synopsis:) !!!!Requirements: E must be boost::(:link - 1 - - 0 - - -30 - - - 2 - :), or a type that derives (indirectly) from boost::(:link - 1 - - 0 - - -30 - - - 2 - :). !!!!Effects: Stores a copy of v into x. If x already contains data of type (:link - 1 - - 0 - - -31 - - - 2 - :)<Tag,T>, that data is overwritten. !!!!Returns: x. (:include throws:) - - - - - 0 - - -20 + -22 @@ -6510,7 +6716,7 @@ 0 - -32 + -13 2 @@ -6519,7 +6725,7 @@ 0 - -20 + -22 2 @@ -6528,7 +6734,7 @@ 0 - -20 + -22 2 @@ -6537,7 +6743,7 @@ 0 - -8 + -5 2 @@ -6546,7 +6752,7 @@ 0 - -32 + -13 2 @@ -6555,7 +6761,7 @@ 0 - -34 + -37 2 @@ -6564,7 +6770,7 @@ 0 - -8 + -5 2 @@ -6573,7 +6779,7 @@ 0 - -27 + -31 2 @@ -6582,7 +6788,7 @@ 0 - -30 + -34 2 @@ -6591,57 +6797,13 @@ 0 - -32 + -13 2 :) functionality. - - - 0 - - -21 - - - - 5 - 2 - (:auto !!!:) (:include synopsis:) !!!!Requirements: E must be boost::(:link - 1 - - 0 - - -30 - - - 2 - :), or a type that derives (indirectly) from boost::(:link - 1 - - 0 - - -30 - - - 2 - :). !!!!Effects: Equivalent to x << v.(:link http://www.boost.org/libs/tuple/doc/tuple_users_guide.html#accessing_elements|get:)<0>() << ... << v.(:link http://www.boost.org/libs/tuple/doc/tuple_users_guide.html#accessing_elements|get:)<N>(). !!!!Returns: x. (:include throws:) - - - - - 0 - - -22 - - - - 1 - 2 - (:auto !!:) !!!Synopsis (:include synopsis:) - - 0 @@ -6650,9 +6812,171 @@ - 1 + 37 2 - (:auto !!:) !!!Synopsis (:include synopsis:) + (:auto !!!:) When you catch an exception, you can call (:link + 1 + + 0 + + -5 + + + 2 + :) to get an (:link + 1 + + 0 + + -13 + + + 2 + :) object: [@#include <(:link + 1 + + 0 + + -53 + + + 2 + :)> #include <boost/thread.hpp> #include <boost/bind.hpp> void do_work(); //throws cloning-enabled boost::(:link + 1 + + 0 + + -34 + + + 2 + :)s void worker_thread( boost::(:link + 1 + + 0 + + -13 + + + 2 + :) & error ) { try { do_work(); error = boost::(:link + 1 + + 0 + + -13 + + + 2 + :)(); } catch( ... ) { error = boost::(:link + 1 + + 0 + + -5 + + + 2 + :)(); } }@] In the above example, note that (:link + 1 + + 0 + + -5 + + + 2 + :) captures the original type of the exception object. The exception can be thrown again using the (:link + 1 + + 0 + + -32 + + + 2 + :) function: [@// ...continued void work() { boost::(:link + 1 + + 0 + + -13 + + + 2 + :) error; boost::(:link http://www.boost.org/doc/html/boost/thread.html|thread:) t( boost::(:link http://www.boost.org/libs/bind/bind.html|bind:)(worker_thread,boost::(:link http://www.boost.org/doc/html/ref.html|ref:)(error)) ); t.(:link http://www.boost.org/doc/html/boost/thread.html|join:)(); if( error ) boost::(:link + 1 + + 0 + + -32 + + + 2 + :)(error); }@] Note that (:link + 1 + + 0 + + -5 + + + 2 + :) could fail to copy the original exception object in the following cases: * if there is not enough memory, in which case the returned (:link + 1 + + 0 + + -13 + + + 2 + :) points to an instance of std::bad_alloc, or * if (:link + 1 + + 0 + + -22 + + + 2 + :) was not used in the throw-expression passed to the original throw statement and the current implementation does not have the necessary compiler-specific support to copy the exception automatically, in which case the returned (:link + 1 + + 0 + + -13 + + + 2 + :) points to an instance of (:link + 1 + + 0 + + -37 + + + 2 + :). Regardless, the use of (:link + 1 + + 0 + + -5 + + + 2 + :) and (:link + 1 + + 0 + + -32 + + + 2 + :) in the above examples is well-formed. @@ -6663,18 +6987,27 @@ - 3 + 5 2 - (:auto !!!:) (:include decl:) !!!!Effects: Frees all resources associated with a boost::(:link + (:auto !!!:) (:include synopsis:) !!!!Effects: As if [@try { throw 1 0 - -30 + -22 2 - :) object. !!!!Throws: Nothing. + (e); } catch(...) { return (:link + 1 + + 0 + + -5 + + + 2 + :)(); }@] @@ -6685,7 +7018,27 @@ - 0 + 5 + 2 + (:auto !!!:) (:include synopsis:) !!!!Requirements: E must be boost::(:link + 1 + + 0 + + -34 + + + 2 + :), or a type that derives (indirectly) from boost::(:link + 1 + + 0 + + -34 + + + 2 + :). !!!!Effects: Equivalent to x << v.(:link http://www.boost.org/libs/tuple/doc/tuple_users_guide.html#accessing_elements|get:)<0>() << ... << v.(:link http://www.boost.org/libs/tuple/doc/tuple_users_guide.html#accessing_elements|get:)<N>(). !!!!Returns: x. (:include throws:) @@ -6696,54 +7049,9 @@ - 11 + 1 2 - (:auto !!:) Boost Exception supports transporting of exception objects between threads through cloning. This system is similar to (:link http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2179.html|N2179:), but because Boost Exception can not rely on language support, the use of (:link - 1 - - 0 - - -20 - - - 2 - :) at the time of the throw is required in order to use cloning. !!!!Note: All exceptions emitted by the familiar function boost::(:link - 1 - - 0 - - -27 - - - 2 - :) are guaranteed to derive from boost::(:link - 1 - - 0 - - -30 - - - 2 - :) and to support cloning. (:include - 1 - - 0 - - -51 - - - 2 - :) (:include - 1 - - 0 - - -14 - - - 2 - :) + (:auto !!:) !!!Synopsis (:include synopsis:) @@ -6754,63 +7062,9 @@ - 13 + 1 2 - (:auto !!!:) (:include synopsis:) !!!!Requirements: E must derive publicly from std::exception. !!!!Effects: * If BOOST_NO_EXCEPTIONS is not defined, boost::(:link - 1 - - 0 - - -27 - - - 2 - :)(e) is equivalent to throw boost::(:link - 1 - - 0 - - -20 - - - 2 - :)(boost::(:link - 1 - - 0 - - -6 - - - 2 - :)(e)), unless BOOST_EXCEPTION_DISABLE is defined, in which case boost::(:link - 1 - - 0 - - -27 - - - 2 - :)(e) is equivalent to throw e; * If BOOST_NO_EXCEPTIONS is defined, the function is left undefined, and the user is expected to supply an appropriate definition. Callers of (:link - 1 - - 0 - - -27 - - - 2 - :) are allowed to assume that the function never returns; therefore, if the user-defined (:link - 1 - - 0 - - -27 - - - 2 - :) returns, the behavior is undefined. + (:auto !!:) !!!Synopsis (:include synopsis:) @@ -6821,90 +7075,18 @@ - 19 + 3 2 - (:auto !!:) Boost Exception provides a namespace-scope function (:link + (:auto !!!:) (:include decl:) !!!!Effects: Frees all resources associated with a boost::(:link 1 0 - -35 + -34 2 - :) which takes a boost::(:link - 1 - - 0 - - -30 - - - 2 - :). The returned string contains: *the string representation of all data objects added to the boost::(:link - 1 - - 0 - - -30 - - - 2 - :) through (:link - 1 - - 0 - - -19 - - - 2 - mod="/":); *the output from std::exception::what; *additional platform-specific diagnostic information. The returned string is not presentable as a friendly user message, but because it is generated automatically, it is useful for debugging or logging purposes. Here is an example: [@#include <(:link - 1 - - 0 - - -37 - - - 2 - :)> #include <iostream> void f(); //throws unknown types that derive from boost::(:link - 1 - - 0 - - -30 - - - 2 - :). void g() { try { f(); } catch( boost::(:link - 1 - - 0 - - -30 - - - 2 - :) & e ) { std::cerr << (:link - 1 - - 0 - - -35 - - - 2 - :)(e); } }@] (:include - 1 - - 0 - - -52 - - - 2 - :) + :) object. !!!!Throws: Nothing. @@ -6915,9 +7097,9 @@ - 5 + 69 2 - (:auto !!!:) Exception types should use virtual inheritance when deriving from other exception types. This insight is due to Andrew Koenig. Using virtual inheritance prevents ambiguity problems in the exception handler: [@#include <iostream> struct my_exc1 : std::exception { char const* what() const throw(); }; struct my_exc2 : std::exception { char const* what() const throw(); }; struct your_exc3 : my_exc1, my_exc2 {}; int main() { try { throw your_exc3(); } catch(std::exception const& e) {} catch(...) { std::cout << "whoops!" << std::endl; } }@] The program above outputs "whoops!" because the conversion to std::exception is ambiguous. The overhead introduced by virtual inheritance is always negligible in the context of exception handling. Note that virtual bases are initialized directly by the constructor of the most-derived-type (the type passed to the throw statement, in case of exceptions.) However, typically this detail is of no concern when boost::(:link + !!Introduction The purpose of Boost Exception is to ease the design of exception class hierarchies and to help write exception handling and error reporting code. It supports transporting of arbitrary data to the catch site, which is otherwise tricky due to the no-throw requirements (15.5.1) for exception types. Data can be added to any exception object, either directly in the throw-expression (15.1), or at a later time as the exception object propagates up the call stack. The ability to add data to exception objects after they have been passed to throw is important, because often some of the information needed to handle an exception is unavailable in the context where the failure is detected. Boost Exception also supports (:link http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2179.html|N2179:)-style (:link 1 0 @@ -6926,7 +7108,34 @@ 2 - :) is used, because it enables exception types to be trivial structs with no members (there's nothing to initialize.) See (:link + |copying:) of exception objects, implemented non-intrusively and automatically by the boost::(:link + 1 + + 0 + + -31 + + + 2 + :) function. !!Contents #(:link + 1 + + 0 + + -9 + + + 2 + :) #Tutorial ##(:link + 1 + + 0 + + -8 + + + 2 + mod="w":) ##(:link 1 0 @@ -6935,7 +7144,268 @@ 2 - mod="w":). + mod="w":) ##(:link + 1 + + 0 + + -11 + + + 2 + mod="w":) ##(:link + 1 + + 0 + + -30 + + + 2 + mod="w":) ##(:link + 1 + + 0 + + -10 + + + 2 + mod="w":) ##(:link + 1 + + 0 + + -33 + + + 2 + mod="w":) #Documentation ##Class (:link + 1 + + 0 + + -34 + + + 2 + :) ##Throwing Exceptions ###(:link + 1 + + 0 + + -7 + + + 2 + :) ###(:link + 1 + + 0 + + -31 + + + 2 + :) ##Transporting of Arbitrary Data to the Catch Site ###(:link + 1 + + 0 + + -35 + + + 2 + :) ###(:link + 1 + + 0 + + -15 + + + 2 + :) ###(:link + 1 + + 0 + + -25 + + + 2 + :) ###(:link + 1 + + 0 + + -20 + + + 2 + :) ###(:link + 1 + + 0 + + -14 + + + 2 + :) ##(:link http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2179.html|N2179:) Transporting of Exceptions between Threads ###(:link + 1 + + 0 + + -13 + + + 2 + :) ###(:link + 1 + + 0 + + -22 + + + 2 + :) ###(:link + 1 + + 0 + + -5 + + + 2 + :) ###(:link + 1 + + 0 + + -24 + + + 2 + :) ###(:link + 1 + + 0 + + -32 + + + 2 + :) ###(:link + 1 + + 0 + + -37 + + + 2 + :) ##Diagnostic Information ###(:link + 1 + + 0 + + -6 + + + 2 + :) ###(:link + 1 + + 0 + + -18 + + + 2 + :) ##(:link + 1 + + 0 + + -38 + + + 2 + :) #API ##(:link + 1 + + 0 + + -60 + + + 2 + :) ##(:link + 1 + + 0 + + -49 + + + 2 + :) ##(:link + 1 + + 0 + + -39 + + + 2 + :) ##(:link + 1 + + 0 + + -44 + + + 2 + :) ##(:link + 1 + + 0 + + -51 + + + 2 + :) ##(:link + 1 + + 0 + + -16 + + + 2 + mod="w":) #(:link + 1 + + 0 + + -12 + + + 2 + mod="w":) #(:link + 1 + + 0 + + -55 + + + 2 + mod="w":) !!!Acknowledgements Peter Dimov has been continuously influencing the design and evolution of Boost Exception. Also thanks to Tobias Schwinger, Tom Brinkman, Pavel Vozenilek and everyone who participated in the review process. @@ -6946,27 +7416,18 @@ - 13 + 11 2 - (:auto !!!:) (:include synopsis:) Class boost::(:link + (:auto !!:) Boost Exception supports transporting of exception objects between threads through cloning. This system is similar to (:link http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2179.html|N2179:), but because Boost Exception can not rely on language support, the use of (:link 1 0 - -30 + -22 2 - :) is designed to be used as a universal base for user-defined exception types. An object of any type deriving from boost::(:link - 1 - - 0 - - -30 - - - 2 - :) can store data of arbitrary types, using the (:link + :) at the time of the throw is required in order to use cloning. !!!!Note: All exceptions emitted by the familiar function boost::(:link 1 0 @@ -6975,34 +7436,34 @@ 2 - :) wrapper and (:link + :) are guaranteed to derive from boost::(:link 1 0 - -19 + -34 2 - mod="/":). To retrieve data from a boost::(:link + :) and to support cloning. (:include 1 0 - -30 + -36 2 - :) object, use the (:link + :) (:include 1 0 - -12 + -23 2 - :) function template. + :) @@ -7013,9 +7474,9 @@ - 37 + 13 2 - (:auto !!!:) (:include synopsis:) !!!!Requirements: T must have accessible copy constructor and must not be a reference (there is no requirement that T's copy constructor does not throw.) !!!!Description: This class template is used to associate a Tag type with a value type T. Objects of type (:link + (:auto !!!:) (:include synopsis:) !!!!Requirements: E must derive publicly from std::exception. !!!!Effects: * If BOOST_NO_EXCEPTIONS is not defined, boost::(:link 1 0 @@ -7024,34 +7485,25 @@ 2 - :)<Tag,T> can be passed to (:link + :)(e) is equivalent to throw boost::(:link 1 0 - -19 + -22 2 - mod="/":) to be stored in objects of type boost::(:link + :)(boost::(:link 1 0 - -30 + -14 2 - :). !!!!Usage: The header <(:link - 1 - - 0 - - -40 - - - 2 - :)> provides a declaration of the (:link + :)(e)), unless BOOST_EXCEPTION_DISABLE is defined, in which case boost::(:link 1 0 @@ -7060,16 +7512,7 @@ 2 - :) template, which is sufficient for the purpose of typedefing an instance for specific Tag and T, for example: [@#include <(:link - 1 - - 0 - - -40 - - - 2 - :)> struct tag_errno; typedef boost::(:link + :)(e) is equivalent to throw e; * If BOOST_NO_EXCEPTIONS is defined, the function is left undefined, and the user is expected to supply an appropriate definition. Callers of (:link 1 0 @@ -7078,16 +7521,7 @@ 2 - :)<tag_errno,int> errno_info;@] Or, the shorter equivalent: [@#include <(:link - 1 - - 0 - - -40 - - - 2 - :)> typedef boost::(:link + :) are allowed to assume that the function never returns; therefore, if the user-defined (:link 1 0 @@ -7096,88 +7530,7 @@ 2 - :)<struct tag_errno,int> errno_info;@] This errno_info typedef can be passed to (:link - 1 - - 0 - - -19 - - - 2 - mod="/":) (#include <(:link - 1 - - 0 - - -41 - - - 2 - :)> first) to store an int named tag_errno in exceptions of types that derive from boost::(:link - 1 - - 0 - - -30 - - - 2 - :): [@throw file_read_error() (:link - 1 - - 0 - - -19 - - - 2 - |<<:) errno_info(errno);@] It can also be passed to - 1 - - 0 - - -12 - - - 2 - (#include < - 1 - - 0 - - -23 - - - 2 - > first) to retrieve the tag_errno int from a boost::(:link - 1 - - 0 - - -30 - - - 2 - :): [@catch( boost::(:link - 1 - - 0 - - -30 - - - 2 - :) & x ) { if( boost::shared_ptr<int const> e=boost:: - 1 - - 0 - - -12 - - - 2 - <errno_info>(x) ) .... }@] + :) returns, the behavior is undefined. @@ -7187,91 +7540,6 @@ -32 - - 17 - 2 - (:auto !!!:) (:include synopsis:) The (:link - 1 - - 0 - - -32 - - - 2 - :) type can be used to refer to a copy of an exception object. It is Default Constructible, Copy Constructible, Assignable and Equality Comparable; (:link - 1 - - 0 - - -32 - - - 2 - :)'s operations do not throw. Two instances of (:link - 1 - - 0 - - -32 - - - 2 - :) are equivalent and compare equal if and only if they refer to the same exception. The default constructor of (:link - 1 - - 0 - - -32 - - - 2 - :) produces the null value of the type. The null value is equivalent only to itself. !!!!Thread safety * It is legal for multiple threads to hold (:link - 1 - - 0 - - -32 - - - 2 - :) references to the same exception object. * It is illegal for multiple threads to modify the same (:link - 1 - - 0 - - -32 - - - 2 - :) object concurrently. * While calling (:link - 1 - - 0 - - -8 - - - 2 - :) makes a copy of the current exception object, it is still possible for the two copies to share internal state. Therefore, in general it is not safe to call (:link - 1 - - 0 - - -33 - - - 2 - :) concurrently to throw the same exception object into multiple threads. - - - - - 0 - - -33 - - 1 2 @@ -7282,31 +7550,98 @@ 0 - -34 + -33 5 2 - (:auto !!!:) (:include synopsis:) This type is used by the (:link + (:auto !!!:) Exception types should use virtual inheritance when deriving from other exception types. This insight is due to Andrew Koenig. Using virtual inheritance prevents ambiguity problems in the exception handler: [@#include <iostream> struct my_exc1 : std::exception { char const* what() const throw(); }; struct my_exc2 : std::exception { char const* what() const throw(); }; struct your_exc3 : my_exc1, my_exc2 {}; int main() { try { throw your_exc3(); } catch(std::exception const& e) {} catch(...) { std::cout << "whoops!" << std::endl; } }@] The program above outputs "whoops!" because the conversion to std::exception is ambiguous. The overhead introduced by virtual inheritance is always negligible in the context of exception handling. Note that virtual bases are initialized directly by the constructor of the most-derived-type (the type passed to the throw statement, in case of exceptions.) However, typically this detail is of no concern when boost::(:link 1 0 - -32 + -34 2 - :) support in Boost Exception. Please see (:link + :) is used, because it enables exception types to be trivial structs with no members (there's nothing to initialize.) See (:link 1 0 - -8 + -10 2 - :). + mod="w":). + + + + + 0 + + -34 + + + + 13 + 2 + (:auto !!!:) (:include synopsis:) Class boost::(:link + 1 + + 0 + + -34 + + + 2 + :) is designed to be used as a universal base for user-defined exception types. An object of any type deriving from boost::(:link + 1 + + 0 + + -34 + + + 2 + :) can store data of arbitrary types, using the (:link + 1 + + 0 + + -35 + + + 2 + :) wrapper and (:link + 1 + + 0 + + -15 + + + 2 + mod="/":). To retrieve data from a boost::(:link + 1 + + 0 + + -34 + + + 2 + :) object, use the (:link + 1 + + 0 + + -20 + + + 2 + :) function template. @@ -7317,81 +7652,9 @@ - 23 + 37 2 - (:auto !!!:) (:include synopsis:) !!!!Returns: This function returns a string value that is automatically composed from the string representations of all (:link - 1 - - 0 - - -31 - - - 2 - :) objects stored in a boost::(:link - 1 - - 0 - - -30 - - - 2 - :) through (:link - 1 - - 0 - - -19 - - - 2 - mod="/":), along with other diagnostic information relevant to the exception. The string representation of each (:link - 1 - - 0 - - -31 - - - 2 - :) object is deduced by a function call that is bound at the time the (:link - 1 - - 0 - - -31 - - - 2 - :)<Tag,T> template is instantiated. The following overload resolutions are attempted in order: #Unqualified call to to_string(x), where x is of type (:link - 1 - - 0 - - -31 - - - 2 - :)<Tag,T> (the return value is expected to be of type std::string.) #Unqualified call to to_string(x.(:link - 1 - - 0 - - -48 - - - 2 - mod="m":)()) (the return value is expected to be of type std::string.) #Unqualified call to s << x.(:link - 1 - - 0 - - -48 - - - 2 - mod="m":)(), where s is a std::ostringstream. The first successfully bound function is used at the time (:link + (:auto !!!:) (:include synopsis:) !!!!Requirements: T must have accessible copy constructor and must not be a reference (there is no requirement that T's copy constructor does not throw.) !!!!Description: This class template is used to associate a Tag type with a value type T. Objects of type (:link 1 0 @@ -7400,16 +7663,88 @@ 2 - :) is called; if all 3 overload resolutions are unsuccessful, the system is unable to convert the (:link + :)<Tag,T> can be passed to (:link 1 0 - -31 + -15 2 - :) object to string, and ''an unspecified stub string value is used without issuing a compile error.'' !!!!Notes: *The format of the returned string is unspecified. *The returned string is ''not'' user-friendly. *If dynamic_cast<std::exception const *>(&x) is not null, the returned string includes the output from std::exception::what. *The returned string may include additional platform-specific diagnostic information. (:include + mod="/":) to be stored in objects of type boost::(:link + 1 + + 0 + + -34 + + + 2 + :). !!!!Usage: The header <(:link + 1 + + 0 + + -50 + + + 2 + :)> provides a declaration of the (:link + 1 + + 0 + + -35 + + + 2 + :) template, which is sufficient for the purpose of typedefing an instance for specific Tag and T, for example: [@#include <(:link + 1 + + 0 + + -50 + + + 2 + :)> struct tag_errno; typedef boost::(:link + 1 + + 0 + + -35 + + + 2 + :)<tag_errno,int> errno_info;@] Or, the shorter equivalent: [@#include <(:link + 1 + + 0 + + -50 + + + 2 + :)> typedef boost::(:link + 1 + + 0 + + -35 + + + 2 + :)<struct tag_errno,int> errno_info;@] This errno_info typedef can be passed to (:link + 1 + + 0 + + -15 + + + 2 + mod="/":) (#include <(:link 1 0 @@ -7418,7 +7753,70 @@ 2 - :) + :)> first) to store an int named tag_errno in exceptions of types that derive from boost::(:link + 1 + + 0 + + -34 + + + 2 + :): [@throw file_read_error() (:link + 1 + + 0 + + -15 + + + 2 + |<<:) errno_info(errno);@] It can also be passed to + 1 + + 0 + + -20 + + + 2 + (#include < + 1 + + 0 + + -27 + + + 2 + > first) to retrieve the tag_errno int from a boost::(:link + 1 + + 0 + + -34 + + + 2 + :): [@catch( boost::(:link + 1 + + 0 + + -34 + + + 2 + :) & x ) { if( boost::shared_ptr<int const> e=boost:: + 1 + + 0 + + -20 + + + 2 + <errno_info>(x) ) .... }@] @@ -7429,68 +7827,50 @@ - 15 + 11 2 - (:auto !!!:) Boost Exception responds to the following configuration macros: '''BOOST_NO_RTTI'''\\ '''BOOST_NO_TYPEID''' The first macro prevents Boost Exception from using dynamic_cast and dynamic typeid. If the second macro is also defined, Boost Exception does not use static typeid either. There are no observable degrading effects on the library functionality, except for the following: ->By default, the (:link + (:auto !!!:) Here is how cloning can be enabled in a throw-expression (15.1): [@#include <(:link 1 0 - -12 + -52 2 - :) function template can be called with any exception type. If BOOST_NO_RTTI is defined, (:link + :)> #include <stdio.h> #include <errno.h> typedef boost::error_info<struct tag_errno,int> errno_info; class file_read_error: public boost::(:link 1 0 - -12 + -34 2 - :) can be used only with objects of type boost::(:link + :) { }; void file_read( FILE * f, void * buffer, size_t size ) { if( size!=fread(buffer,1,size,f) ) throw boost::(:link 1 0 - -30 + -22 2 - :). !!!!Note: The library needs RTTI functionality. Disabling the language RTTI support enables an internal RTTI system, which may have more or less overhead depending on the platform. '''BOOST_EXCEPTION_DISABLE''' By default, (:link + :)(file_read_error()) << errno_info(errno); }@] Of course, (:link 1 0 - -20 + -22 2 - :) and (:link + :) may be used with any exception type; there is no requirement that it should derive from boost::(:link 1 0 - -6 - - - 2 - :) are integrated directly in the (:link - 1 - - 0 - - -27 - - - 2 - :) function. Defining BOOST_EXCEPTION_DISABLE disables this integration. Note that on some non-conformant compilers, for example MSVC 7.0 and older, as well as BCC, BOOST_EXCEPTION_DISABLE is implicitly defined in (:link - 1 - - 0 - - -44 + -34 2 @@ -7505,9 +7885,27 @@ - 1 + 5 2 - (:auto !!:) !!!Synopsis (:include synopsis:) + (:auto !!!:) (:include synopsis:) This type is used by the (:link + 1 + + 0 + + -13 + + + 2 + :) support in Boost Exception. Please see (:link + 1 + + 0 + + -5 + + + 2 + :). @@ -7520,7 +7918,7 @@ 1 2 - (:auto !!:) !!!Synopsis (:include synopsis:) + (:auto !!!:) (:include synopsis:) !!!!Requirements: This function must not be called outside of a catch block. !!!!Returns: A pointer of type E to the current exception object, or null if the current exception object can not be converted to E *. !!!!Throws: Nothing. @@ -7533,7 +7931,7 @@ 1 2 - (:auto !!!:) !!!Synopsis (:include synopsis:) + (:auto !!:) (:pagelist fmt="index" tags="type":) @@ -7544,9 +7942,90 @@ - 1 + 19 2 - (:auto !!:) !!!Synopsis (:include synopsis:) + (:auto !!!:) Sometimes the throw site does not have all the information that is needed at the catch site to make sense of what went wrong. Let's say we have an exception type file_read_error, which takes a file name in its constructor. Consider the following function: [@void file_read( FILE * f, void * buffer, size_t size ) { if( size!=fread(buffer,1,size,f) ) throw file_read_error(????); }@] How can the file_read function pass a file name to the exception type constructor? All it has is a FILE handle. Using boost::(:link + 1 + + 0 + + -34 + + + 2 + :) allows us to free the file_read function from the burden of storing the file name in exceptions it throws: [@#include <(:link + 1 + + 0 + + -46 + + + 2 + :)> #include <stdio.h> #include <errno.h> typedef boost::(:link + 1 + + 0 + + -35 + + + 2 + :)<struct tag_errno,int> errno_info; class file_read_error: public boost::(:link + 1 + + 0 + + -34 + + + 2 + :) { }; void file_read( FILE * f, void * buffer, size_t size ) { if( size!=fread(buffer,1,size,f) ) throw file_read_error() << errno_info(errno); }@] If file_read detects a failure, it throws an exception which contains the information that is available at the time, namely the errno. Other relevant information, such as the file name, can be added in a context higher up the call stack, where it is known naturally: [@#include <(:link + 1 + + 0 + + -46 + + + 2 + :)> #include <boost/shared_ptr.hpp> #include <stdio.h> #include <string> typedef boost::(:link + 1 + + 0 + + -35 + + + 2 + :)<struct tag_file_name,std::string> file_name_info; boost::shared_ptr<FILE> file_open( char const * file_name, char const * mode ); void file_read( FILE * f, void * buffer, size_t size ); void parse_file( char const * file_name ) { boost::shared_ptr<FILE> f = file_open(file_name,"rb"); assert(f); try { char buf[1024]; file_read( f.get(), buf, sizeof(buf) ); } catch( boost::(:link + 1 + + 0 + + -34 + + + 2 + :) & e ) { e << file_name_info(file_name); throw; } }@] The above function is (almost) exception-neutral -- if an exception is emitted by any function call within the try block, parse_file does not need to do any real work, but it intercepts any boost::(:link + 1 + + 0 + + -34 + + + 2 + :) object, stores the file name, and re-throws using a throw-expression with no operand (15.1.6). The rationale for catching any boost::(:link + 1 + + 0 + + -34 + + + 2 + :) object is that the file name is relevant to any failure that occurs in parse_file, ''even if the failure is unrelated to file I/O''. @@ -7570,9 +8049,36 @@ - 1 + 7 2 - (:auto !!:) !!!Synopsis (:include synopsis:) + (:auto !!!:) (:include decl:) !!!!Effects: * Default constructor: initializes an empty boost::(:link + 1 + + 0 + + -34 + + + 2 + :) object. * Copy constructor: initializes a boost::(:link + 1 + + 0 + + -34 + + + 2 + :) object which shares ownership with x of all data added through (:link + 1 + + 0 + + -15 + + + 2 + mod="/":), including data that is added at a future time. !!!!Throws: Nothing. @@ -7583,9 +8089,27 @@ - 1 + 5 2 - (:auto !!:) !!!Synopsis (:include synopsis:) + (:auto !!!:) (:include synopsis:) !!!!Description: Returns a const reference to the copy of the value passed to (:link + 1 + + 0 + + -35 + + + 2 + :)'s constructor stored in the (:link + 1 + + 0 + + -35 + + + 2 + :) object. !!!!Throws: Nothing. @@ -7598,7 +8122,7 @@ 1 2 - (:auto !!:) !!!Synopsis (:include synopsis:) + (:auto !!:) (:pagelist fmt="index" tags="function":) @@ -7609,7 +8133,9 @@ - 0 + 1 + 2 + (:auto !!:) !!!Synopsis (:include synopsis:) @@ -7620,81 +8146,9 @@ - 17 + 1 2 - (:auto !!!:) The following example demonstrates how errno can be stored in exception objects using Boost Exception: [@#include <(:link - 1 - - 0 - - -37 - - - 2 - :)> #include <errno.h> #include <iostream> typedef boost::(:link - 1 - - 0 - - -31 - - - 2 - :)<struct tag_errno,int> errno_info; //(1) class my_error: public boost::(:link - 1 - - 0 - - -30 - - - 2 - :), public std::exception { }; //(2) void f() { throw my_error() << errno_info(errno); //(3) } @] First, we instantiate the (:link - 1 - - 0 - - -31 - - - 2 - :) template using a unique identifier -- tag_errno, and the type of the info it identifies -- int. This provides compile-time type safety for the various values stored in exception objects. Second, we define class my_error, which derives from boost::(:link - 1 - - 0 - - -30 - - - 2 - :). Finally, (3) illustrates how the typedef from (1) can be used with (:link - 1 - - 0 - - -19 - - - 2 - |operator<<:) to store values in exception objects at the point of the throw. The stored errno value can be recovered at a later time like this: [@// ...continued void g() { try { f(); } catch( my_error & x ) { if( boost::shared_ptr<int const> err=boost::(:link - 1 - - 0 - - -12 - - - 2 - :)<errno_info>(x) ) std::cerr << "Error code: " << *err; } }@] The (:link - 1 - - 0 - - -12 - - - 2 - :) function template is instantiated with the typedef from (1), and is passed an exception object of a polymorphic type. If the exception object contains the requested value, the returned (:link http://www.boost.org/libs/smart_ptr/shared_ptr.htm|shared_ptr:) will point to it; otherwise an empty (:link http://www.boost.org/libs/smart_ptr/shared_ptr.htm|shared_ptr:) is returned. + (:auto !!:) !!!Synopsis (:include synopsis:) @@ -7712,7 +8166,7 @@ 0 - -31 + -35 2 @@ -7736,27 +8190,9 @@ - 5 + 1 2 - (:auto !!!:) (:include synopsis:) !!!!Description: Returns a const reference to the copy of the value passed to (:link - 1 - - 0 - - -31 - - - 2 - :)'s constructor stored in the (:link - 1 - - 0 - - -31 - - - 2 - :) object. !!!!Throws: Nothing. + (:auto !!!:) !!!Synopsis (:include synopsis:) @@ -7767,36 +8203,9 @@ - 7 + 1 2 - (:auto !!!:) (:include decl:) !!!!Effects: * Default constructor: initializes an empty boost::(:link - 1 - - 0 - - -30 - - - 2 - :) object. * Copy constructor: initializes a boost::(:link - 1 - - 0 - - -30 - - - 2 - :) object which shares ownership with x of all data added through (:link - 1 - - 0 - - -19 - - - 2 - mod="/":), including data that is added at a future time. !!!!Throws: Nothing. + (:auto !!:) (:pagelist fmt="index" tags="hpp" sort_prefix="6":) @@ -7807,63 +8216,9 @@ - 13 + 1 2 - (:auto !!!:) The code snippet below demonstrates how boost::(:link http://www.boost.org/libs/tuple/doc/tuple_users_guide.html|tuple:) can be used to bundle the name of the function that failed, together with the reported errno so that they can be added to exception objects more conveniently together: [@#include <(:link - 1 - - 0 - - -42 - - - 2 - :)> #include <boost/shared_ptr.hpp> #include <stdio.h> #include <string> #include <errno.h> typedef boost::(:link - 1 - - 0 - - -31 - - - 2 - :)<struct tag_file_name,std::string> file_name_info; typedef boost::(:link - 1 - - 0 - - -31 - - - 2 - :)<struct tag_function,char const *> function_info; typedef boost::(:link - 1 - - 0 - - -31 - - - 2 - :)<struct tag_errno,int> errno_info; typedef boost::tuple<function_info,errno_info> clib_failure; class file_open_error: public boost::(:link - 1 - - 0 - - -30 - - - 2 - :) { }; boost::shared_ptr<FILE> file_open( char const * name, char const * mode ) { if( FILE * f=fopen(name,mode) ) return boost::shared_ptr<FILE>(f,fclose); else throw file_open_error() << file_name_info(name) << clib_failure("fopen",errno); }@] Note that the members of a boost::(:link http://www.boost.org/libs/tuple/doc/tuple_users_guide.html|tuple:) are stored separately in exception objects; they can only be retrieved individually, using (:link - 1 - - 0 - - -12 - - - 2 - :). + (:auto !!:) !!!Synopsis (:include synopsis:) @@ -7874,54 +8229,9 @@ - 11 + 1 2 - (:auto !!!:) Here is how cloning can be enabled in a throw-expression (15.1): [@#include <(:link - 1 - - 0 - - -41 - - - 2 - :)> #include <stdio.h> #include <errno.h> typedef boost::error_info<struct tag_errno,int> errno_info; class file_read_error: public boost::(:link - 1 - - 0 - - -30 - - - 2 - :) { }; void file_read( FILE * f, void * buffer, size_t size ) { if( size!=fread(buffer,1,size,f) ) throw boost::(:link - 1 - - 0 - - -20 - - - 2 - :)(file_read_error()) << errno_info(errno); }@] Of course, (:link - 1 - - 0 - - -20 - - - 2 - :) may be used with any exception type; there is no requirement that it should derive from boost::(:link - 1 - - 0 - - -30 - - - 2 - :). + (:auto !!:) (:pagelist tags="macro":) @@ -7932,9 +8242,83 @@ - 3 + 1 2 - !!!!Example: this is a possible output from the (:link + (:auto !!:) !!!Synopsis (:include synopsis:) + + + + + 0 + + -53 + + + + 1 + 2 + (:auto !!:) !!!Synopsis (:include synopsis:) + + + + + 0 + + -54 + + + + 1 + 2 + (:auto !!:) !!!Synopsis (:include synopsis:) + + + + + 0 + + -55 + + + + 1 + 2 + (:auto !:) This is an alphabetical list of all Boost Exception documentation pages. (:pagelist fmt="index" except_tags="index noindex" mod="w":) + + + + + 0 + + -56 + + + + 1 + 2 + (:auto !!:) !!!Synopsis (:include synopsis:) + + + + + 0 + + -57 + + + + 17 + 2 + (:auto !!!:) The following example demonstrates how errno can be stored in exception objects using Boost Exception: [@#include <(:link + 1 + + 0 + + -46 + + + 2 + :)> #include <errno.h> #include <iostream> typedef boost::(:link 1 0 @@ -7943,7 +8327,361 @@ 2 - :) function, as used in ''libs/exception/example/example_io.cpp:'' [@libs\exception\example\example_io.cpp(83): Throw in function class boost::shared_ptr<struct _iobuf> __cdecl my_fopen(const char *,const char *) Dynamic exception type: class boost::exception_detail::clone_impl<class fopen_error> std::exception::what: example_io error [struct tag_errno *] = 2, OS says "No such file or directory" [struct tag_file_name *] = tmp1.txt [struct tag_function *] = fopen [struct tag_open_mode *] = rb@] + :)<struct tag_errno,int> errno_info; //(1) class my_error: public boost::(:link + 1 + + 0 + + -34 + + + 2 + :), public std::exception { }; //(2) void f() { throw my_error() << errno_info(errno); //(3) } @] First, we instantiate the (:link + 1 + + 0 + + -35 + + + 2 + :) template using a unique identifier -- tag_errno, and the type of the info it identifies -- int. This provides compile-time type safety for the various values stored in exception objects. Second, we define class my_error, which derives from boost::(:link + 1 + + 0 + + -34 + + + 2 + :). Finally, (3) illustrates how the typedef from (1) can be used with (:link + 1 + + 0 + + -15 + + + 2 + |operator<<:) to store values in exception objects at the point of the throw. The stored errno value can be recovered at a later time like this: [@// ...continued void g() { try { f(); } catch( my_error & x ) { if( int const * err=boost::(:link + 1 + + 0 + + -20 + + + 2 + :)<errno_info>(x) ) std::cerr << "Error code: " << *err; } }@] The (:link + 1 + + 0 + + -20 + + + 2 + :) function template is instantiated with the typedef from (1), and is passed an exception object of a polymorphic type. If the exception object contains the requested value, err will point to it; otherwise a null pointer is returned. + + + + + 0 + + -58 + + + + 3 + 2 + !!!!Example: this is a possible output from the (:link + 1 + + 0 + + -6 + + + 2 + :) function, as used in ''libs/exception/example/example_io.cpp:'' [@example_io.cpp(83): Throw in function class boost::shared_ptr<struct _iobuf> __cdecl my_fopen(const char *,const char *) Dynamic exception type: class boost::exception_detail::clone_impl<class fopen_error> std::exception::what: example_io error [struct tag_errno *] = 2, OS says "No such file or directory" [struct tag_file_name *] = tmp1.txt [struct tag_function *] = fopen [struct tag_open_mode *] = rb@] + + + + + 0 + + -59 + + + + 13 + 2 + (:auto !!!:) The code snippet below demonstrates how boost::(:link http://www.boost.org/libs/tuple/doc/tuple_users_guide.html|tuple:) can be used to bundle the name of the function that failed, together with the reported errno so that they can be added to exception objects more conveniently together: [@#include <(:link + 1 + + 0 + + -45 + + + 2 + :)> #include <boost/shared_ptr.hpp> #include <stdio.h> #include <string> #include <errno.h> typedef boost::(:link + 1 + + 0 + + -35 + + + 2 + :)<struct tag_file_name,std::string> file_name_info; typedef boost::(:link + 1 + + 0 + + -35 + + + 2 + :)<struct tag_function,char const *> function_info; typedef boost::(:link + 1 + + 0 + + -35 + + + 2 + :)<struct tag_errno,int> errno_info; typedef boost::tuple<function_info,errno_info> clib_failure; class file_open_error: public boost::(:link + 1 + + 0 + + -34 + + + 2 + :) { }; boost::shared_ptr<FILE> file_open( char const * name, char const * mode ) { if( FILE * f=fopen(name,mode) ) return boost::shared_ptr<FILE>(f,fclose); else throw file_open_error() << file_name_info(name) << clib_failure("fopen",errno); }@] Note that the members of a boost::(:link http://www.boost.org/libs/tuple/doc/tuple_users_guide.html|tuple:) are stored separately in exception objects; they can only be retrieved individually, using (:link + 1 + + 0 + + -20 + + + 2 + :). + + + + + 0 + + -60 + + + + 45 + 2 + !!Synopsis List of documented definitions, declarations and includes by header file: `#include <(:link + 1 + + 0 + + -26 + + + 2 + :)> [@(:include + 1 + + 0 + + -26 + + + 2 + synopsis:)@] `#include <(:link + 1 + + 0 + + -50 + + + 2 + :)> [@(:include + 1 + + 0 + + -50 + + + 2 + synopsis:)@] `#include <(:link + 1 + + 0 + + -52 + + + 2 + :)> [@(:include + 1 + + 0 + + -52 + + + 2 + synopsis:)@] `#include <(:link + 1 + + 0 + + -45 + + + 2 + :)> [@(:include + 1 + + 0 + + -45 + + + 2 + synopsis:)@] `#include <(:link + 1 + + 0 + + -48 + + + 2 + :)> [@(:include + 1 + + 0 + + -48 + + + 2 + synopsis:)@] `#include <(:link + 1 + + 0 + + -41 + + + 2 + :)> [@(:include + 1 + + 0 + + -41 + + + 2 + synopsis:)@] `#include <(:link + 1 + + 0 + + -56 + + + 2 + :)> [@(:include + 1 + + 0 + + -56 + + + 2 + synopsis:)@] `#include <(:link + 1 + + 0 + + -53 + + + 2 + :)> [@(:include + 1 + + 0 + + -53 + + + 2 + synopsis:)@] `#include <(:link + 1 + + 0 + + -19 + + + 2 + :)> [@(:include + 1 + + 0 + + -19 + + + 2 + synopsis:)@] `#include <(:link + 1 + + 0 + + -54 + + + 2 + :)> [@(:include + 1 + + 0 + + -54 + + + 2 + synopsis:)@] `#include <(:link + 1 + + 0 + + -46 + + + 2 + :)> (:include + 1 + + 0 + + -46 + + + 2 + synopsis:) @@ -7953,13 +8691,13 @@ throws - 57 + 65 reno_layer - 48 + 56 0 @@ -8056,9 +8794,7 @@ - 1 - 2 - !!!!Throws: Any exception emitted by v's copy constructor. + 0 @@ -8080,7 +8816,9 @@ - 0 + 1 + 2 + !!!!Throws: std::bad_alloc, or any exception emitted by the T copy constructor. @@ -8124,9 +8862,7 @@ - 1 - 2 - !!!!Throws: std::bad_alloc, or any exception emitted by the T copy constructor. + 0 @@ -8150,7 +8886,7 @@ 1 2 - !!!!Throws: std::bad_alloc, or any exception emitted by T1..TN copy constructor. + !!!!Throws: Any exception emitted by v's copy constructor. @@ -8194,7 +8930,9 @@ - 0 + 1 + 2 + !!!!Throws: std::bad_alloc, or any exception emitted by T1..TN copy constructor. @@ -8494,6 +9232,94 @@ 0 + + + 0 + + -53 + + + + 0 + + + + + 0 + + -54 + + + + 0 + + + + + 0 + + -55 + + + + 0 + + + + + 0 + + -56 + + + + 0 + + + + + 0 + + -57 + + + + 0 + + + + + 0 + + -58 + + + + 0 + + + + + 0 + + -59 + + + + 0 + + + + + 0 + + -60 + + + + 0 + + @@ -8501,13 +9327,13 @@ synopsis - 58 + 66 reno_layer - 48 + 56 0 @@ -8518,16 +9344,16 @@ 3 2 - `#include < + `#include <(:link 1 0 - -44 + -53 2 - > (:include decl:) + :)> [@namespace boost { (:include decl pre_indent="4":) }@] @@ -8540,16 +9366,16 @@ 3 2 - `#include < + `#include <(:link 1 0 - -39 + -41 2 - > [@namespace boost { (:include decl pre_indent="4":) }@] + :)>\\ [@namespace boost { (:include decl pre_indent="4":) }@] @@ -8562,16 +9388,16 @@ 3 2 - `#include <(:link + `#include < 1 0 - -43 + -54 2 - :)> [@namespace boost { (:include decl pre_indent="4":) }@] + > (:include decl:) @@ -8582,18 +9408,7 @@ - 3 - 2 - `#include <(:link - 1 - - 0 - - -43 - - - 2 - :)> [@namespace boost { (:include decl pre_indent="4":) }@] + 0 @@ -8615,18 +9430,7 @@ - 3 - 2 - [@#include < - 1 - - 0 - - -22 - - - 2 - > namespace boost { (:include api pre_indent="4":) }@] + 0 @@ -8648,18 +9452,7 @@ - 3 - 2 - `#include < - 1 - - 0 - - -23 - - - 2 - > [@namespace boost { (:include decl pre_indent="4":) }@] + 0 @@ -8677,11 +9470,11 @@ 0 - -41 + -53 2 - :)> [@(:include decl:)@] + :)> [@namespace boost { (:include decl pre_indent="4":) }@] @@ -8692,7 +9485,18 @@ - 0 + 3 + 2 + `#include < + 1 + + 0 + + -48 + + + 2 + > [@namespace boost { (:include decl pre_indent="4":) }@] @@ -8703,7 +9507,18 @@ - 0 + 3 + 2 + `#include <(:link + 1 + + 0 + + -52 + + + 2 + :)>\\ [@namespace boost { (:include decl pre_indent="4":) }@] @@ -8735,17 +9550,6 @@ -18 - - 0 - - - - - 0 - - -19 - - 3 2 @@ -8765,22 +9569,35 @@ 0 - -20 + -19 3 2 - `#include < + [@#include < 1 0 - -10 + -26 2 - > [@namespace boost { (:include decl pre_indent="4":) }@] + > namespace boost { (:include api pre_indent="4":) }@] + + + + + 0 + + -20 + + + + 1 + 2 + [@namespace boost { (:include decl pre_indent="4":) }@] @@ -8790,6 +9607,83 @@ -21 + + 3 + 2 + `#include <(:link + 1 + + 0 + + -52 + + + 2 + :)> [@(:include decl:)@] + + + + + 0 + + -22 + + + + 3 + 2 + `#include < + 1 + + 0 + + -19 + + + 2 + > [@namespace boost { (:include decl pre_indent="4":) }@] + + + + + 0 + + -23 + + + + 0 + + + + + 0 + + -24 + + + + 3 + 2 + `#include <(:link + 1 + + 0 + + -53 + + + 2 + :)> [@namespace boost { (:include decl pre_indent="4":) }@] + + + + + 0 + + -25 + + 5 2 @@ -8798,7 +9692,7 @@ 0 - -42 + -45 2 @@ -8807,7 +9701,7 @@ 0 - -21 + -25 2 @@ -8818,7 +9712,7 @@ 0 - -22 + -26 @@ -8831,7 +9725,7 @@ 0 - -23 + -27 @@ -8840,61 +9734,6 @@ [@#include <boost/shared_ptr.hpp> namespace boost { (:include api pre_indent="4":) }@] - - - 0 - - -24 - - - - 0 - - - - - 0 - - -25 - - - - 0 - - - - - 0 - - -26 - - - - 0 - - - - - 0 - - -27 - - - - 3 - 2 - `#include <(:link - 1 - - 0 - - -44 - - - 2 - :)> [@namespace boost { (:include decl:) }@] - - 0 @@ -8925,18 +9764,7 @@ - 3 - 2 - `#include <(:link - 1 - - 0 - - -22 - - - 2 - :)> [@namespace boost { (:include def pre_indent="4":) }@] + 0 @@ -8954,11 +9782,11 @@ 0 - -41 + -54 2 - :)> [@namespace boost { (:include def pre_indent="4":) }@] + :)> [@namespace boost { (:include decl:) }@] @@ -8976,7 +9804,7 @@ 0 - -43 + -53 2 @@ -8991,18 +9819,7 @@ - 3 - 2 - `#include <(:link - 1 - - 0 - - -43 - - - 2 - :)> [@namespace boost { (:include decl pre_indent="4":) }@] + 0 @@ -9020,11 +9837,11 @@ 0 - -43 + -26 2 - :)> [@namespace boost { (:include decl pre_indent="4":) }@] + :)> [@namespace boost { (:include def pre_indent="4":) }@] @@ -9042,11 +9859,11 @@ 0 - -38 + -52 2 - :)>\\ [@namespace boost { (:include decl pre_indent="4":) }@] + :)> [@namespace boost { (:include def pre_indent="4":) }@] @@ -9068,9 +9885,18 @@ - 1 + 3 2 - [@(:include api:)@] + `#include <(:link + 1 + + 0 + + -53 + + + 2 + :)> [@namespace boost { (:include decl pre_indent="4":) }@] @@ -9081,18 +9907,9 @@ - 3 + 1 2 - [@#include <string> namespace boost { (:include - 1 - - 0 - - -30 - - - 2 - decl pre_indent="4":) (:include api pre_indent="4":) }@] + [@namespace boost { (:include decl pre_indent="4":) }@] @@ -9103,18 +9920,7 @@ - 3 - 2 - [@#include < - 1 - - 0 - - -22 - - - 2 - > namespace boost { (:include api pre_indent="4":) }@] + 0 @@ -9125,9 +9931,7 @@ - 1 - 2 - [@namespace boost { (:include api pre_indent="4":) }@] + 0 @@ -9140,16 +9944,16 @@ 3 2 - [@#include <(:link + [@#include <string> namespace boost { (:include 1 0 - -22 + -34 2 - :)> #include <boost/current_function.hpp> #include <boost/shared_ptr.hpp> namespace boost { (:include api pre_indent="4":) }@] + decl pre_indent="4":) (:include api pre_indent="4":) }@] @@ -9160,9 +9964,7 @@ - 1 - 2 - [@#include <boost/tuple/tuple.hpp> namespace boost { (:include api pre_indent="4":) }@] + 0 @@ -9175,16 +9977,16 @@ 3 2 - [@#include <(:link + `#include <(:link 1 0 - -22 + -52 2 - :)> namespace boost { (:include api pre_indent="4":) }@] + :)> [@(:include decl:)@] @@ -9195,9 +9997,7 @@ - 1 - 2 - (:include api:) + 0 @@ -9208,7 +10008,18 @@ - 0 + 3 + 2 + [@#include < + 1 + + 0 + + -52 + + + 2 + > #include <boost/tuple/tuple.hpp> namespace boost { (:include api pre_indent="4":) }@] @@ -9219,7 +10030,9 @@ - 0 + 1 + 2 + [@(:include api:)@] @@ -9237,7 +10050,7 @@ 0 - -41 + -52 2 @@ -9254,16 +10067,16 @@ 3 2 - `#include <(:link + [@#include < 1 0 - -41 + -26 2 - :)> [@(:include decl:)@] + > namespace boost { (:include api pre_indent="4":) }@] @@ -9285,7 +10098,9 @@ - 0 + 1 + 2 + [@namespace boost { (:include api pre_indent="4":) }@] @@ -9306,6 +10121,120 @@ -52 + + 3 + 2 + [@#include <(:link + 1 + + 0 + + -26 + + + 2 + :)> namespace boost { (:include api pre_indent="4":) }@] + + + + + 0 + + -53 + + + + 3 + 2 + [@#include <(:link + 1 + + 0 + + -26 + + + 2 + :)> namespace boost { (:include api pre_indent="4":) }@] + + + + + 0 + + -54 + + + + 1 + 2 + (:include api:) + + + + + 0 + + -55 + + + + 0 + + + + + 0 + + -56 + + + + 1 + 2 + [@namespace boost { (:include api pre_indent="4":) }@] + + + + + 0 + + -57 + + + + 0 + + + + + 0 + + -58 + + + + 0 + + + + + 0 + + -59 + + + + 0 + + + + + 0 + + -60 + + 0 @@ -9320,14 +10249,14 @@ - 59 + 67 reno_context_map - 48 + 56 -5 @@ -9472,11 +10401,35 @@ -52 + + -53 + + + -54 + + + -55 + + + -56 + + + -57 + + + -58 + + + -59 + + + -60 + - 48 + 56 @@ -9491,7 +10444,7 @@ - -25 + -29 @@ -9508,7 +10461,7 @@ - -26 + -30 @@ -9525,7 +10478,7 @@ - -15 + -8 @@ -9542,7 +10495,7 @@ - -45 + -55 @@ -9559,7 +10512,58 @@ - -39 + -48 + + + + + + + 0 + + + + + + 1 + + + + -19 + + + + + + + 0 + + + + + + 1 + + + + -9 + + + + + + + 0 + + + + + + 1 + + + + -33 @@ -9593,7 +10597,7 @@ - -16 + -12 @@ -9610,7 +10614,7 @@ - -29 + -44 @@ -9627,7 +10631,7 @@ - -17 + -49 @@ -9644,87 +10648,41 @@ - -18 + -39 - 2 - 00067869F918D0E8905D8A464C17FA9DAD9F497B3A172EB360239EEB5778A206 - 3465219615 - 4025 - 518 - 6E325144EF4F41FA3A225EB30729101382C4E99B3D6160E307311E4B4E641010 - 1097215175 - 161 - 240 + 0 - 0 - ../../../../boost/exception/info.hpp - 0 - 0 + 1 - -13 + -51 - 2 - 00067869F918D0E8905D8A464C17FA9DAD9F497B3A172EB360239EEB5778A206 - 3465219615 - 4025 - 518 - D31BCE814DF5B8B718E7EB67A194AD08EF716A26D422E436596ABA1F145007D8 - 4055211476 - 525 - 3494 + 0 - 0 - ../../../../boost/exception/info.hpp - 0 - 0 + 1 - -19 - - - - - - - 1 - FBC69CDA5E19FA40270F3855A8B99B2F77572439353F9DC5D15386F3520BC616 - 1405483403 - 8882 - 323 - - - - - - 0 - ../../../../boost/exception_ptr.hpp - 0 - 0 - - - - -43 + -60 @@ -9748,7 +10706,7 @@ - -14 + -23 @@ -9756,23 +10714,23 @@ 1 - F6C6B72C2CDEBC5E3EAA924F637563A8F8A95684AF6EEF39FE2260C86C77F531 - 2151348977 - 3846 - 323 + 9E8DCE3BCF462A3A332DA70F61E46FA5C2AB791B95E33D3F2AF1307F53C84B1C + 1960675522 + 6483 + 591 0 - ../../../../boost/exception/get_error_info.hpp + ../../example/example_io.cpp 0 0 - -23 + -58 @@ -9796,7 +10754,7 @@ - -9 + -11 @@ -9804,14 +10762,182 @@ 2 - E8AFD260BD0196A516F0E29A9FE6D09BF84B37D31E228910E3370365CAA4AB43 - 3229661566 - 3665 + 6FB85B536F965F137409D5B5D34786DCBF0B9957A7C251D271B717A1156B823D + 1090406464 + 362 + 323 + D16DAEA8B1792A019AF7FCA362FDC6EFD381AF4C43C076A01C029ECE51F994A6 + 3172941848 + 330 + 26 + + + + + + 0 + ../../../../boost/exception/current_exception_cast.hpp + 0 + 0 + + + + -38 + + + + + + + 2 + 9748FFBBC9F02FEB97E0BA1E6280C51FFF5D7F217F0F12EE8ED29F6BE5CCCE44 + 2533933282 + 8724 + 615 + 9F3671DA5E8AB414F1FBA3B160D49134EAEE8DFF33E95376EDB41534E916FF38 + 2436936467 + 718 + 1496 + + + + + + 0 + ../../../../boost/exception_ptr.hpp + 0 + 0 + + + + -37 + + + + + + + 2 + 9748FFBBC9F02FEB97E0BA1E6280C51FFF5D7F217F0F12EE8ED29F6BE5CCCE44 + 2533933282 + 8724 + 615 + E23085202D084CBB50F289988A6A592F06D923B77D0AB25D7A98A7188DF5BE3B + 1414247481 + 766 + 7388 + + + + + + 0 + ../../../../boost/exception_ptr.hpp + 0 + 0 + + + + -5 + + + + + + + 2 + 9748FFBBC9F02FEB97E0BA1E6280C51FFF5D7F217F0F12EE8ED29F6BE5CCCE44 + 2533933282 + 8724 + 615 + F86EB07D04CD0D0645080D1121DA899746D0C45137E17E1D9BE605E75396F047 + 1983537541 + 1346 + 148 + + + + + + 0 + ../../../../boost/exception_ptr.hpp + 0 + 0 + + + + -13 + + + + + + + 2 + 9748FFBBC9F02FEB97E0BA1E6280C51FFF5D7F217F0F12EE8ED29F6BE5CCCE44 + 2533933282 + 8724 + 615 + 0E9DF8366080712A816BE91ABCEF1E2044145B63D75B0B995B537900F378189E + 1069696031 + 255 + 8463 + + + + + + 0 + ../../../../boost/exception_ptr.hpp + 0 + 0 + + + + -32 + + + + + + + 2 + 9748FFBBC9F02FEB97E0BA1E6280C51FFF5D7F217F0F12EE8ED29F6BE5CCCE44 + 2533933282 + 8724 + 615 + 0066D4E6E6B189906E6DE04F08509F3737511701A1B1355B37511EC18E8371F4 + 2078296250 + 305 + 8156 + + + + + + 0 + ../../../../boost/exception_ptr.hpp + 0 + 0 + + + + -24 + + + + + + + 2 + FEABD2D011FBCE667D26BAD68A1C65D81E98DD40081CC70F2738AC3151A8FC4A + 4260129224 + 2393 504 - BB8AF986C96801345719855FEA083AF5684FBC349F6520E150F19A6370019265 - 3731478139 - 686 - 2973 + C708EDCAC3964E2F3C3A081700112C5F15C7BF7A61FDF2EF39D112FC9B987CE3 + 1739153824 + 2361 + 26 @@ -9824,31 +10950,7 @@ - -12 - - - - - - - 1 - 17FF6C63843EE64ED66CB038DD95B4C4D6BA1B0FD36B27BEFD84A909161D2853 - 1237535165 - 231 - 1186 - - - - - - 0 - ../../../../boost/throw_exception.hpp - 0 - 0 - - - - -5 + -20 @@ -9872,7 +10974,7 @@ - -28 + -17 @@ -9896,7 +10998,135 @@ - -37 + -46 + + + + + + + 2 + 1D3204D3ADDAB7AA716BEA1489EA852A9D6B5C110243364F6931FEF1CC2E5F88 + 422052608 + 3923 + 518 + 6E325144EF4F41FA3A225EB30729101382C4E99B3D6160E307311E4B4E641010 + 1097215175 + 161 + 240 + + + + + + 0 + ../../../../boost/exception/info.hpp + 0 + 0 + + + + -21 + + + + + + + 2 + 1D3204D3ADDAB7AA716BEA1489EA852A9D6B5C110243364F6931FEF1CC2E5F88 + 422052608 + 3923 + 518 + D31BCE814DF5B8B718E7EB67A194AD08EF716A26D422E436596ABA1F145007D8 + 4055211476 + 525 + 3392 + + + + + + 0 + ../../../../boost/exception/info.hpp + 0 + 0 + + + + -15 + + + + + + + 1 + D10E536B909EFFF78FB09E6242AEC7C74ACDD75AE7DF32B45870422B752E5D8E + 1903336130 + 557 + 382 + + + + + + 0 + ../../example/error_info_1.cpp + 0 + 0 + + + + -57 + + + + + + + 1 + 05698FEF1D553EDBC15212673561F5436DF771AA5488C8ED8164D303078DE08E + 119041194 + 1978 + 91 + + + + + + 0 + ../../../../boost/throw_exception.hpp + 0 + 0 + + + + -54 + + + + + + + 1 + A449DE2B3A2CDAE9DD932C06D224B3E07C95EBACBB4EA5890CA4CCF2DC74A693 + 1718307056 + 4118 + 323 + + + + + + 0 + ../../../../boost/exception/info.hpp + 0 + 0 + + + + -52 @@ -9907,7 +11137,7 @@ 612485E090D76B2CC43C1A296F813075BA165C2496082E78E939F10B3DA8E09A 1770110914 587 - 1497 + 1462 60F3F48B87487FA6E0D2CCC0750AF435CC92CEC80BBBF609AC71295031AADD0D 3929437933 361 @@ -9924,7 +11154,7 @@ - -27 + -31 @@ -9935,7 +11165,7 @@ 612485E090D76B2CC43C1A296F813075BA165C2496082E78E939F10B3DA8E09A 1770110914 587 - 1497 + 1462 60F3F48B87487FA6E0D2CCC0750AF435CC92CEC80BBBF609AC71295031AADD0D 3929437933 361 @@ -9956,7 +11186,7 @@ - -36 + -16 @@ -9964,23 +11194,23 @@ 1 - D0024B58523F5885E87F608259810B61D3BE489CEC885FFAE91118F1E43B10A4 - 399616739 - 6563 - 591 + A14B5595A6DD87562792D402B48500AAD71FA1ABD75C14EDF089FCC7318CBB9B + 3469762901 + 468 + 227 0 - ../../example/example_io.cpp + ../../../../boost/exception/current_exception_cast.hpp 0 0 - -52 + -56 @@ -10008,7 +11238,7 @@ - -31 + -35 @@ -10072,7 +11302,111 @@ - -48 + -43 + + + + + + + 1 + 2F432507CFD796BE673F33D9AC68C535F1ED1F4FCD3A8E3AEEC320D9795FB4AE + 2319362875 + 2574 + 323 + + + + + + 0 + ../../../../boost/exception/get_error_info.hpp + 0 + 0 + + + + -27 + + + + + + + 2 + F7537DC10435D0F7CC368E0FC747B2B1169E1CE60FCBAE8AC86F2256667C95B2 + 3301865866 + 4151 + 557 + D747B0A0953B72747224DE7856DB793A4BFF7B73793873CF22810FCB304A7310 + 505472020 + 3665 + 26 + + + + + + 0 + ../../../../boost/exception/diagnostic_information.hpp + 0 + 0 + + + + -6 + + + + + + + 2 + F7537DC10435D0F7CC368E0FC747B2B1169E1CE60FCBAE8AC86F2256667C95B2 + 3301865866 + 4151 + 557 + 90ECFCA1DA49DBB79A23B5998A39D8A6B122632524671C56DA10F96A1BA07CD2 + 1653443895 + 452 + 3693 + + + + + + 0 + ../../../../boost/exception/diagnostic_information.hpp + 0 + 0 + + + + -18 + + + + + + + 1 + E127BAFA15A5B7031C0DD1817993041600F935B71E7BDE42E1F4AF50959B6AB3 + 2166367611 + 9016 + 323 + + + + + + 0 + ../../../../boost/exception_ptr.hpp + 0 + 0 + + + + -53 @@ -10096,7 +11430,7 @@ - -22 + -26 @@ -10124,7 +11458,7 @@ - -24 + -28 @@ -10152,7 +11486,7 @@ - -20 + -22 @@ -10180,7 +11514,7 @@ - -6 + -14 @@ -10208,7 +11542,7 @@ - -30 + -34 @@ -10240,7 +11574,7 @@ - -49 + -42 @@ -10264,59 +11598,7 @@ - -42 - - - - - - - 2 - 3D64A3F5639045A59A0CD362AD4C531ECC763B7C523E284DCBFBACAAF5F681C3 - 4142572795 - 1596 - 462 - 6FE1F0AF570A010E8FDA1647DE61E0CC3AA979C8A8638722DAACDF8FBC4790D2 - 1246830037 - 1023 - 567 - - - - - - 0 - ../../../../boost/exception/diagnostic_information.hpp - 0 - 0 - - - - -35 - - - - - - - 1 - 373FAB70D1DAE4F1111AACCCCD3F6B55EAF8D1222E03A26A5A2F860B70D2D0C4 - 3697768091 - 2013 - 91 - - - - - - 0 - ../../../../boost/throw_exception.hpp - 0 - 0 - - - - -44 + -45 @@ -10340,7 +11622,7 @@ - -51 + -36 @@ -10348,23 +11630,23 @@ 1 - 77680088697752BD6CCF429C0B264C866F5BF1D911D3BF3F1F18B06490D9F0CB - 2016079400 - 1841 - 227 + 04DDC793002AFCF4F4166D250C67D09B6FE8B86224318ED7847AD6EC423B70CA + 922651615 + 433 + 1027 0 - ../../../../boost/exception/diagnostic_information.hpp + ../../../../boost/throw_exception.hpp 0 0 - -38 + -7 @@ -10388,147 +11670,31 @@ - -11 + -40 - 2 - 808CABE6CCA47C52CC9DD21911BF0B42284A5DD55AC3E665B29ED2B5F16AF7DA - 3660693492 - 8718 - 487 - E23085202D084CBB50F289988A6A592F06D923B77D0AB25D7A98A7188DF5BE3B - 1414247481 - 766 - 7382 + 1 + 9E3988368193B192FA2426DE2B97FA8D0DA8A9FFECAD6A010FE1B5CD9662FAE9 + 109897168 + 4491 + 227 0 - ../../../../boost/exception_ptr.hpp + ../../../../boost/exception/diagnostic_information.hpp 0 0 - -8 - - - - - - - 2 - 808CABE6CCA47C52CC9DD21911BF0B42284A5DD55AC3E665B29ED2B5F16AF7DA - 3660693492 - 8718 - 487 - F86EB07D04CD0D0645080D1121DA899746D0C45137E17E1D9BE605E75396F047 - 1983537541 - 1346 - 148 - - - - - - 0 - ../../../../boost/exception_ptr.hpp - 0 - 0 - - - - -32 - - - - - - - 2 - 808CABE6CCA47C52CC9DD21911BF0B42284A5DD55AC3E665B29ED2B5F16AF7DA - 3660693492 - 8718 - 487 - DA033132CFA8F85C147C01F51FF7CF7399CF7D32D412F730EA3219CDAC608C72 - 3830952485 - 712 - 1496 - - - - - - 0 - ../../../../boost/exception_ptr.hpp - 0 - 0 - - - - -34 - - - - - - - 2 - 808CABE6CCA47C52CC9DD21911BF0B42284A5DD55AC3E665B29ED2B5F16AF7DA - 3660693492 - 8718 - 487 - 0E9DF8366080712A816BE91ABCEF1E2044145B63D75B0B995B537900F378189E - 1069696031 - 255 - 8457 - - - - - - 0 - ../../../../boost/exception_ptr.hpp - 0 - 0 - - - - -33 - - - - - - - 2 - 808CABE6CCA47C52CC9DD21911BF0B42284A5DD55AC3E665B29ED2B5F16AF7DA - 3660693492 - 8718 - 487 - 0066D4E6E6B189906E6DE04F08509F3737511701A1B1355B37511EC18E8371F4 - 2078296250 - 305 - 8150 - - - - - - 0 - ../../../../boost/exception_ptr.hpp - 0 - 0 - - - - -7 + -41 @@ -10556,7 +11722,7 @@ - -40 + -50 @@ -10584,31 +11750,7 @@ - -21 - - - - - - - 1 - 187BFD2B78A0DD006717B5B06FFD465E2468F521C32A86FB793F7A68AB5417F3 - 4276724153 - 574 - 382 - - - - - - 0 - ../../example/error_info_1.cpp - 0 - 0 - - - - -46 + -25 @@ -10632,31 +11774,7 @@ - -50 - - - - - - - 1 - 3D40DD88A1E41D75BC79CA8DACC35BEE2A16A64422AC8E6BE0D61169D9360EF7 - 4184757263 - 4220 - 323 - - - - - - 0 - ../../../../boost/exception/info.hpp - 0 - 0 - - - - -41 + -59 @@ -10666,14 +11784,14 @@ - 60 + 68 tag_index - 44 + 47 1 @@ -10687,7 +11805,7 @@ -5 - + exception_ptr free function @@ -10696,7 +11814,7 @@ -6 - error_info free function + diagnostic_information free function @@ -10705,7 +11823,7 @@ -7 - exception_ptr free function + macro @@ -10714,26 +11832,8 @@ -8 - exception_ptr free function - - - - 0 - - -9 - - tutorial - - - 0 - - -10 - - - exception_ptr - 0 @@ -10741,16 +11841,7 @@ -11 - noalso noindex tutorial - - - - 0 - - -12 - - - error_info free function + tutorial @@ -10759,7 +11850,7 @@ -13 - function member + type @@ -10768,7 +11859,7 @@ -14 - noindex tutorial + error_info free function @@ -10777,94 +11868,13 @@ -15 - tutorial - - - - 0 - - -19 - - error_info free function 0 - -20 - - - exception_ptr free function - - - - 0 - - -21 - - - error_info free function - - - - 0 - - -22 - - - - - - - 0 - - -23 - - - error_info - - - - 0 - - -24 - - - function - - - - 0 - - -25 - - - noindex - - - - 0 - - -26 - - - tutorial - - - - 0 - - -27 - - - free function - - - - 0 - - -28 + -17 diagnostic_information tutorial @@ -10873,43 +11883,43 @@ 0 - -29 + -18 - tutorial + function 0 - -30 + -19 - type + exception_ptr 0 - -31 + -20 - type + error_info free function 0 - -32 + -21 - type + function member 0 - -33 + -22 exception_ptr free function @@ -10918,25 +11928,34 @@ 0 - -34 + -23 - exception_ptr type + noindex tutorial 0 - -35 + -24 - diagnostic_information free function + exception_ptr free function 0 - -37 + -25 + + + error_info free function + + + + 0 + + -26 @@ -10945,20 +11964,110 @@ 0 - -38 - - - - - - - 0 - - -39 + -27 error_info + + + 0 + + -28 + + + function + + + + 0 + + -29 + + + noindex + + + + 0 + + -30 + + + tutorial + + + + 0 + + -31 + + + free function + + + + 0 + + -32 + + + exception_ptr free function + + + + 0 + + -33 + + + tutorial + + + + 0 + + -34 + + + type + + + + 0 + + -35 + + + type + + + + 0 + + -36 + + + noindex tutorial + + + + 0 + + -37 + + + exception_ptr type + + + + 0 + + -38 + + + function + 0 @@ -10966,7 +12075,7 @@ -40 - + noalso noindex tutorial @@ -10984,7 +12093,7 @@ -42 - + function @@ -10993,16 +12102,7 @@ -43 - - - - - 0 - - -44 - - - + function member @@ -11020,7 +12120,7 @@ -46 - noalso noindex tutorial + @@ -11038,16 +12138,7 @@ -48 - function member - - - - 0 - - -49 - - - function + error_info @@ -11056,16 +12147,70 @@ -50 + + + + + 0 + + -52 + + + + + + + 0 + + -53 + + + + + + + 0 + + -54 + + + + + + + 0 + + -55 + + + + + + + 0 + + -56 + + + + + + + 0 + + -57 + + noalso noindex tutorial 0 - -51 + -59 - noindex tutorial + noalso noindex tutorial diff --git a/doc/synopsis.html b/doc/synopsis.html new file mode 100644 index 0000000..b8e3ca3 --- /dev/null +++ b/doc/synopsis.html @@ -0,0 +1,201 @@ + + + + + Synopsis + + + +
    +
    +
    +
    + +

    Boost Exception

    +
    + + + +

    Synopsis

    +

    List of documented definitions, declarations and includes by header file:

    +

    #include <boost/exception/exception.hpp>

    +
    namespace
    +boost
    +    {
    +    class
    +    exception
    +        {
    +        protected:
    +    
    +        exception();
    +        exception( exception const & x );    
    +        ~exception();    
    +        };    
    +    
    +    template <class Tag,class T>
    +    class error_info;    
    +    
    +    typedef error_info<struct tag_throw_function,char const *> throw_function;
    +    typedef error_info<struct tag_throw_file,char const *> throw_file;
    +    typedef error_info<struct tag_throw_line,int> throw_line;
    +    }
    +

    #include <boost/exception/error_info.hpp>

    +
    namespace
    +boost
    +    {
    +    template <class Tag,class T>
    +    class error_info;
    +    }
    +

    #include <boost/exception/info.hpp>

    +
    #include <boost/exception/exception.hpp>
    +
    +namespace
    +boost
    +    {
    +    template <class Tag,class T>
    +    class
    +    error_info
    +        {
    +        public:
    +    
    +        typedef T value_type;    
    +    
    +        error_info( value_type const & v );    
    +        value_type const & value() const;    
    +        };    
    +    
    +    template <class E, class Tag, class T>
    +    E const & operator<<( E const & x, error_info<Tag,T> const & v );
    +    }
    +

    #include <boost/exception/info_tuple.hpp>

    +
    #include <boost/exception/info.hpp>
    +#include <boost/tuple/tuple.hpp>
    +
    +namespace
    +boost
    +    {
    +    template <class E, class Tag1, class T1, ..., class TagN, class TN>
    +    E const & operator<<( E const & x,
    +        tuple<
    +            error_info<Tag1,T1>,
    +            ...,
    +            error_info<TagN,TN> > const & v );
    +    }
    +

    #include <boost/exception/enable_error_info.hpp>

    +
    #include <boost/exception/exception.hpp>
    +
    +namespace
    +boost
    +    {
    +    template <class T>
    +    ---unspecified--- enable_error_info( T const & x );
    +    }
    +

    #include <boost/exception/diagnostic_information.hpp>

    +
    #include <string>
    +
    +namespace
    +boost
    +    {
    +    class exception;
    +
    +    template <class E>
    +    std::string diagnostic_information( E const & e );    
    +    
    +    std::string current_exception_diagnostic_information();
    +    }
    +

    #include <boost/exception/current_exception_cast.hpp>

    +
    namespace
    +boost
    +    {
    +    template <class E>
    +    E * current_exception_cast();
    +    }
    +

    #include <boost/exception_ptr.hpp>

    +
    #include <boost/exception/exception.hpp>
    +
    +namespace
    +boost
    +    {
    +    class
    +    unknown_exception:
    +        public std::exception
    +        public boost::exception
    +        {
    +        ---unspecified---
    +        };    
    +    
    +    typedef ---unspecified--- exception_ptr;    
    +    
    +    template <class T>
    +    exception_ptr copy_exception( T const & e );    
    +    
    +    exception_ptr current_exception();    
    +    
    +    void rethrow_exception( exception_ptr const & ep );
    +    }
    +

    #include <boost/exception/enable_current_exception.hpp>

    +
    #include <boost/exception/exception.hpp>
    +
    +namespace
    +boost
    +    {
    +    template <class T>
    +    ---unspecified--- enable_current_exception( T const & e );
    +    }
    +

    #include <boost/throw_exception.hpp>

    +
    #if !defined( BOOST_EXCEPTION_DISABLE ) + #include <boost/exception/exception.hpp> + #include <boost/current_function.hpp> + #define BOOST_THROW_EXCEPTION(x)\ + ::boost::throw_exception( ::boost::enable_error_info(x) <<\ + ::boost::throw_function(BOOST_CURRENT_FUNCTION) <<\ + ::boost::throw_file(__FILE__) <<\ + ::boost::throw_line((int)__LINE__) ) +#else + #define BOOST_THROW_EXCEPTION(x) ::boost::throw_exception(x) +#endif + +namespace +boost + { +#ifdef BOOST_NO_EXCEPTIONS + void throw_exception( std::exception const & e ); // user defined +#else + template <class E> + void throw_exception( E const & e ); +#endif + }
    +

    #include <boost/exception.hpp>

    +

    +

    See Also:

    + +
    + + + + +
    +
    +
    + + diff --git a/doc/throw_exception_hpp.html b/doc/throw_exception_hpp.html index 57c5cf6..9743a27 100644 --- a/doc/throw_exception_hpp.html +++ b/doc/throw_exception_hpp.html @@ -22,7 +22,7 @@

    boost/throw_exception.hpp

    Synopsis

    -
    #if !defined( BOOST_NO_EXCEPTIONS ) && !defined( BOOST_EXCEPTION_DISABLE )
    +
    #if !defined( BOOST_EXCEPTION_DISABLE )
         #include <boost/exception/exception.hpp>
         #include <boost/current_function.hpp>
         #define BOOST_THROW_EXCEPTION(x)\
    @@ -47,8 +47,8 @@ boost
     
    diff --git a/doc/tutorial_diagnostic_information.html b/doc/tutorial_diagnostic_information.html index ef0feb0..835d4d6 100644 --- a/doc/tutorial_diagnostic_information.html +++ b/doc/tutorial_diagnostic_information.html @@ -47,7 +47,7 @@ g() }

    Example:

    this is a possible output from the diagnostic_information function, as used in libs/exception/example/example_io.cpp:

    -
    libs\exception\example\example_io.cpp(83): Throw in function class boost::shared_ptr<struct _iobuf> __cdecl my_fopen(const char *,const char *)
    +
    example_io.cpp(83): Throw in function class boost::shared_ptr<struct _iobuf> __cdecl my_fopen(const char *,const char *)
     Dynamic exception type: class boost::exception_detail::clone_impl<class fopen_error>
     std::exception::what: example_io error
     [struct tag_errno *] = 2, OS says "No such file or directory"
    diff --git a/doc/tutorial_transporting_data.html b/doc/tutorial_transporting_data.html
    index 96931ff..816015b 100644
    --- a/doc/tutorial_transporting_data.html
    +++ b/doc/tutorial_transporting_data.html
    @@ -59,11 +59,11 @@ g()
         catch(
         my_error & x )
             {
    -        if( boost::shared_ptr<int const> err=boost::get_error_info<errno_info>(x) )
    +        if( int const * err=boost::get_error_info<errno_info>(x) )
                 std::cerr << "Error code: " << *err;
             }
         }
    -

    The get_error_info function template is instantiated with the typedef from (1), and is passed an exception object of a polymorphic type. If the exception object contains the requested value, the returned shared_ptr will point to it; otherwise an empty shared_ptr is returned.

    +

    The get_error_info function template is instantiated with the typedef from (1), and is passed an exception object of a polymorphic type. If the exception object contains the requested value, err will point to it; otherwise a null pointer is returned.

    Adding of Arbitrary Data to Active Exception Objects

    Sometimes the throw site does not have all the information that is needed at the catch site to make sense of what went wrong. Let's say we have an exception type file_read_error, which takes a file name in its constructor. Consider the following function:

    diff --git a/doc/types.html b/doc/types.html new file mode 100644 index 0000000..2f2c94d --- /dev/null +++ b/doc/types.html @@ -0,0 +1,54 @@ + + + + + Types + + + +
    +
    +
    +
    + +

    Boost Exception

    +
    + + + +

    +

    See Also:

    + +
    + + + + +
    +
    +
    + + diff --git a/example/error_info_1.cpp b/example/error_info_1.cpp index b67f728..8b0dcc1 100644 --- a/example/error_info_1.cpp +++ b/example/error_info_1.cpp @@ -30,7 +30,7 @@ g() catch( my_error & x ) { - if( boost::shared_ptr err=boost::get_error_info(x) ) + if( int const * err=boost::get_error_info(x) ) std::cerr << "Error code: " << *err; } } diff --git a/example/example_io.cpp b/example/example_io.cpp index 4b3a5a3..b031112 100644 --- a/example/example_io.cpp +++ b/example/example_io.cpp @@ -132,7 +132,7 @@ copy_data( char const * src_file_name, char const * dst_file_name ) catch( boost::exception & x ) { - if( boost::shared_ptr const> f=boost::get_error_info(x) ) + if( boost::weak_ptr const * f=boost::get_error_info(x) ) if( boost::shared_ptr fs = f->lock() ) { if( fs==src ) @@ -150,37 +150,37 @@ copy_data( char const * src_file_name, char const * dst_file_name ) void dump_copy_info( boost::exception const & x ) { - if( boost::shared_ptr src = boost::get_error_info(x) ) - std::cout << "Source file name: " << *src << "\n"; - if( boost::shared_ptr dst = boost::get_error_info(x) ) - std::cout << "Destination file name: " << *dst << "\n"; + if( std::string const * src = boost::get_error_info(x) ) + std::cerr << "Source file name: " << *src << "\n"; + if( std::string const * dst = boost::get_error_info(x) ) + std::cerr << "Destination file name: " << *dst << "\n"; } void dump_file_info( boost::exception const & x ) { - if( boost::shared_ptr fn = boost::get_error_info(x) ) - std::cout << "File name: " << *fn << "\n"; + if( std::string const * fn = boost::get_error_info(x) ) + std::cerr << "File name: " << *fn << "\n"; } void dump_clib_info( boost::exception const & x ) { - if( boost::shared_ptr err=boost::get_error_info(x) ) - std::cout << "OS error: " << *err << "\n"; - if( boost::shared_ptr fn=boost::get_error_info(x) ) - std::cout << "Failed function: " << *fn << "\n"; + if( int const * err=boost::get_error_info(x) ) + std::cerr << "OS error: " << *err << "\n"; + if( std::string const * fn=boost::get_error_info(x) ) + std::cerr << "Failed function: " << *fn << "\n"; } void dump_all_info( boost::exception const & x ) { - std::cout << "-------------------------------------------------\n"; + std::cerr << "-------------------------------------------------\n"; dump_copy_info(x); dump_file_info(x); dump_clib_info(x); - std::cout << "\nOutput from diagnostic_information():\n"; - std::cout << diagnostic_information(x); + std::cerr << "\nOutput from diagnostic_information():\n"; + std::cerr << diagnostic_information(x); } int @@ -199,7 +199,7 @@ main() catch( read_error & x ) { - std::cout << "\nCaught 'read_error' exception.\n"; + std::cerr << "\nCaught 'read_error' exception.\n"; dump_all_info(x); } @@ -212,14 +212,14 @@ main() catch( open_error & x ) { - std::cout << "\nCaught 'open_error' exception.\n"; + std::cerr << "\nCaught 'open_error' exception.\n"; dump_all_info(x); } } catch( - boost::exception & x ) + ... ) { - std::cout << "\nCaught unexpected boost::exception!\n"; - dump_all_info(x); + std::cerr << "\nCaught unexpected exception!\n"; + std::cerr << boost::current_exception_diagnostic_information(); } } diff --git a/include/boost/exception/current_exception_cast.hpp b/include/boost/exception/current_exception_cast.hpp new file mode 100644 index 0000000..1147d71 --- /dev/null +++ b/include/boost/exception/current_exception_cast.hpp @@ -0,0 +1,34 @@ +//Copyright (c) 2006-2008 Emil Dotchevski and Reverge Studios, Inc. + +//Distributed under the Boost Software License, Version 1.0. (See accompanying +//file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + +#ifndef UUID_7E83C166200811DE885E826156D89593 +#define UUID_7E83C166200811DE885E826156D89593 + +namespace +boost + { + template + inline + E * + current_exception_cast() + { + try + { + throw; + } + catch( + E & e ) + { + return &e; + } + catch( + ...) + { + return 0; + } + } + } + +#endif diff --git a/include/boost/exception/diagnostic_information.hpp b/include/boost/exception/diagnostic_information.hpp index af10837..6e2c0ba 100644 --- a/include/boost/exception/diagnostic_information.hpp +++ b/include/boost/exception/diagnostic_information.hpp @@ -8,6 +8,8 @@ #include #include +#include +#include #include #include #include @@ -18,6 +20,38 @@ boost namespace exception_detail { + template + struct + enable_boost_exception_overload + { + typedef struct yes { char q[100]; }; + typedef char no; + static yes check(exception const *); + static no check(...); + enum e { value=sizeof(check((T*)0))==sizeof(yes) }; + }; + + template + struct + enable_std_exception_overload + { + typedef struct yes { char q[100]; }; + typedef char no; + static yes check(std::exception const *); + static no check(...); + enum e { value = !enable_boost_exception_overload::value && sizeof(check((T*)0))==sizeof(yes) }; + }; + +#ifndef BOOST_NO_RTTI + template + inline + std::string + dynamic_exception_type( T const & x ) + { + return std::string("Dynamic exception type: ") + BOOST_EXCEPTION_DYNAMIC_TYPEID(x).name(); + } +#endif + inline char const * get_diagnostic_information( exception const & x ) @@ -36,33 +70,76 @@ boost #endif return 0; } + + inline + std::string + boost_diagnostic_information( exception const & x ) + { + std::ostringstream tmp; + if( char const * const * f=get_error_info(x) ) + { + tmp << *f; + if( int const * l=get_error_info(x) ) + tmp << '(' << *l << "): "; + } + tmp << "Throw in function "; + if( char const * const * fn=get_error_info(x) ) + tmp << *fn; + else + tmp << "(unknown)"; + tmp << std::endl; +#ifndef BOOST_NO_RTTI + tmp << dynamic_exception_type(x) << std::endl; + if( std::exception const * e=dynamic_cast(&x) ) + tmp << "std::exception::what: " << e->what() << std::endl; +#endif + if( char const * s=exception_detail::get_diagnostic_information(x) ) + if( *s ) + tmp << s; + return tmp.str(); + } + + inline + std::string + std_diagnostic_information( std::exception const & x ) + { + std::ostringstream tmp; +#ifndef BOOST_NO_RTTI + if( exception const * e=dynamic_cast(&x) ) + return boost_diagnostic_information(*e); + tmp << dynamic_exception_type(x) << std::endl; +#endif + tmp << "std::exception::what: " << x.what() << std::endl; + return tmp.str(); + } + } + + template + inline + typename enable_if,std::string>::type + diagnostic_information( T const & e ) + { + return exception_detail::boost_diagnostic_information(e); + } + + template + inline + typename enable_if,std::string>::type + diagnostic_information( T const & e ) + { + return exception_detail::std_diagnostic_information(e); } inline std::string - diagnostic_information( exception const & x ) + current_exception_diagnostic_information() { - std::ostringstream tmp; - if( boost::shared_ptr f=get_error_info(x) ) - { - tmp << *f; - if( boost::shared_ptr l=get_error_info(x) ) - tmp << '(' << *l << "): "; - } - tmp << "Throw in function "; - if( boost::shared_ptr fn=get_error_info(x) ) - tmp << *fn; + if( boost::exception const * e=current_exception_cast() ) + return diagnostic_information(*e); + else if( std::exception const * e=current_exception_cast() ) + return diagnostic_information(*e); else - tmp << "(unknown)"; -#ifndef BOOST_NO_RTTI - tmp << "\nDynamic exception type: " << BOOST_EXCEPTION_DYNAMIC_TYPEID(x).name(); - if( std::exception const * e=dynamic_cast(&x) ) - tmp << "\nstd::exception::what: " << e->what(); -#endif - if( char const * s=exception_detail::get_diagnostic_information(x) ) - if( *s ) - tmp << '\n' << s; - return tmp.str(); + return "No diagnostic information available."; } } diff --git a/include/boost/exception/get_error_info.hpp b/include/boost/exception/get_error_info.hpp index 1bca37b..1c34e85 100644 --- a/include/boost/exception/get_error_info.hpp +++ b/include/boost/exception/get_error_info.hpp @@ -17,82 +17,12 @@ boost namespace exception_detail { - struct - strwrap - { - std::string str; - char const * ptr; - - explicit - strwrap( char const * s ): - str(s), - ptr(&str[0]) - { - } - - private: - - strwrap( strwrap const & ); - strwrap & operator=( strwrap const & ); - }; - - template <> - struct - get_info - { - static - shared_ptr - get( exception const & x ) - { - if( x.throw_function_ && *x.throw_function_ ) - { - shared_ptr s(new strwrap(x.throw_function_)); - return shared_ptr(s,&s->ptr); - } - else - return shared_ptr(); - } - }; - - template <> - struct - get_info - { - static - shared_ptr - get( exception const & x ) - { - if( x.throw_file_ && *x.throw_file_ ) - { - shared_ptr s(new strwrap(x.throw_file_)); - return shared_ptr(s,&s->ptr); - } - else - return shared_ptr(); - } - }; - - template <> - struct - get_info - { - static - shared_ptr - get( exception const & x ) - { - if( x.throw_line_!=-1 ) - return boost::shared_ptr(new int(x.throw_line_)); - else - return shared_ptr(); - } - }; - template struct get_info { static - shared_ptr + typename ErrorInfo::value_type const * get( exception const & x ) { if( exception_detail::error_info_container * c=x.data_.get() ) @@ -102,9 +32,45 @@ boost BOOST_ASSERT( 0!=dynamic_cast(eib.get()) ); #endif ErrorInfo const * w = static_cast(eib.get()); - return shared_ptr(eib,&w->value()); + return &w->value(); } - return shared_ptr(); + return 0; + } + }; + + template <> + struct + get_info + { + static + char const * const * + get( exception const & x ) + { + return x.throw_function_ ? &x.throw_function_ : 0; + } + }; + + template <> + struct + get_info + { + static + char const * const * + get( exception const & x ) + { + return x.throw_file_ ? &x.throw_file_ : 0; + } + }; + + template <> + struct + get_info + { + static + int const * + get( exception const & x ) + { + return x.throw_line_!=-1 ? &x.throw_line_ : 0; } }; } @@ -112,7 +78,7 @@ boost #ifdef BOOST_NO_RTTI template inline - shared_ptr + typename ErrorInfo::value_type const * get_error_info( boost::exception const & x ) { return exception_detail::get_info::get(x); @@ -120,13 +86,13 @@ boost #else template inline - shared_ptr + typename ErrorInfo::value_type const * get_error_info( E const & some_exception ) { if( exception const * x = dynamic_cast(&some_exception) ) return exception_detail::get_info::get(*x); else - return shared_ptr(); + return 0; } #endif } diff --git a/include/boost/exception/info.hpp b/include/boost/exception/info.hpp index 64097af..6c18fca 100644 --- a/include/boost/exception/info.hpp +++ b/include/boost/exception/info.hpp @@ -102,17 +102,13 @@ boost { if( diagnostic_info_str_.empty() ) { - std::string tmp; + std::ostringstream tmp; for( error_info_map::const_iterator i=info_.begin(),end=info_.end(); i!=end; ++i ) { shared_ptr const & x = i->second; - tmp += '['; - tmp += x->tag_typeid_name(); - tmp += "] = "; - tmp += x->value_as_string(); - tmp += '\n'; + tmp << '[' << x->tag_typeid_name() << "] = " << x->value_as_string() << std::endl; } - diagnostic_info_str_.swap(tmp); + tmp.str().swap(diagnostic_info_str_); } return diagnostic_info_str_.c_str(); } diff --git a/include/boost/exception_ptr.hpp b/include/boost/exception_ptr.hpp index 5b574d6..4a08811 100644 --- a/include/boost/exception_ptr.hpp +++ b/include/boost/exception_ptr.hpp @@ -103,7 +103,7 @@ boost private: - exception_detail::clone_base const * + exception_detail::clone_base const * clone() const { return new unknown_exception(*this); diff --git a/include/boost/throw_exception.hpp b/include/boost/throw_exception.hpp index 69cdad0..ed03335 100644 --- a/include/boost/throw_exception.hpp +++ b/include/boost/throw_exception.hpp @@ -32,7 +32,7 @@ # define BOOST_EXCEPTION_DISABLE #endif -#if !defined( BOOST_NO_EXCEPTIONS ) && !defined( BOOST_EXCEPTION_DISABLE ) +#if !defined( BOOST_EXCEPTION_DISABLE ) # include # include # define BOOST_THROW_EXCEPTION(x) ::boost::throw_exception(::boost::enable_error_info(x) <<\ diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index 01ff3e5..0e93e28 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -33,6 +33,8 @@ run errno_test.cpp ; run error_info_test.cpp ; run diagnostic_information_test.cpp ; run refcount_ptr_test.cpp ; +run current_exception_cast_test.cpp ; +run no_exceptions_test.cpp : : : off ; compile-fail exception_fail.cpp ; compile-fail throw_exception_fail.cpp ; @@ -47,3 +49,4 @@ compile info_hpp_test.cpp ; compile info_tuple_hpp_test.cpp ; compile to_string_hpp_test.cpp ; compile to_string_stub_hpp_test.cpp ; +compile current_exception_cast_hpp_test.cpp ; diff --git a/test/cloning_test.cpp b/test/cloning_test.cpp index 695e2af..e6dcb6d 100644 --- a/test/cloning_test.cpp +++ b/test/cloning_test.cpp @@ -382,7 +382,7 @@ main() boost::unknown_exception & x ) { BOOST_TEST(boost::get_error_info(x)); - if( boost::shared_ptr p=boost::get_error_info(x) ) + if( int const * p=boost::get_error_info(x) ) BOOST_TEST(*p==42); boost::exception_ptr p = boost::current_exception(); BOOST_TEST(!(p==boost::exception_ptr())); @@ -397,7 +397,7 @@ main() boost::unknown_exception & x ) { BOOST_TEST(boost::get_error_info(x)); - if( boost::shared_ptr p=boost::get_error_info(x) ) + if( int const * p=boost::get_error_info(x) ) BOOST_TEST(*p==42); } catch( @@ -433,7 +433,7 @@ main() boost::unknown_exception & x ) { BOOST_TEST(boost::get_error_info(x)); - if( boost::shared_ptr p=boost::get_error_info(x) ) + if( int const * p=boost::get_error_info(x) ) BOOST_TEST(*p==42); boost::exception_ptr p = boost::current_exception(); BOOST_TEST(!(p==boost::exception_ptr())); @@ -448,7 +448,7 @@ main() boost::unknown_exception & x ) { BOOST_TEST(boost::get_error_info(x)); - if( boost::shared_ptr p=boost::get_error_info(x) ) + if( int const * p=boost::get_error_info(x) ) BOOST_TEST(*p==42); } catch( diff --git a/test/current_exception_cast_hpp_test.cpp b/test/current_exception_cast_hpp_test.cpp new file mode 100644 index 0000000..b73a267 --- /dev/null +++ b/test/current_exception_cast_hpp_test.cpp @@ -0,0 +1,7 @@ +//Copyright (c) 2006-2008 Emil Dotchevski and Reverge Studios, Inc. + +//Distributed under the Boost Software License, Version 1.0. (See accompanying +//file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + +#include +#include diff --git a/test/current_exception_cast_test.cpp b/test/current_exception_cast_test.cpp new file mode 100644 index 0000000..4481b51 --- /dev/null +++ b/test/current_exception_cast_test.cpp @@ -0,0 +1,47 @@ +//Copyright (c) 2006-2008 Emil Dotchevski and Reverge Studios, Inc. + +//Distributed under the Boost Software License, Version 1.0. (See accompanying +//file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + +#include +#include +#include + +class +my_exception: + public std::exception + { + }; + +class +polymorphic + { + virtual + ~polymorphic() + { + } + }; + +int +main() + { + try + { + throw my_exception(); + } + catch( + std::exception & e ) + { + try + { + throw; + } + catch( + ...) + { + BOOST_TEST(boost::current_exception_cast()==&e); + BOOST_TEST(!boost::current_exception_cast()); + } + } + return boost::report_errors(); + } diff --git a/test/diagnostic_information_test.cpp b/test/diagnostic_information_test.cpp index 669b7b0..605701d 100644 --- a/test/diagnostic_information_test.cpp +++ b/test/diagnostic_information_test.cpp @@ -27,8 +27,8 @@ to_string( tagged_int2 const & x ) struct error1: - public std::exception, - public boost::exception + std::exception, + boost::exception { char const * what() const throw() @@ -39,10 +39,42 @@ error1: struct error2: - public boost::exception + boost::exception { }; +void +test1( std::string const & di1, std::string const & di2 ) + { + BOOST_TEST( di1!=di2 ); +#ifndef BOOST_NO_RTTI + BOOST_TEST(di1.find("type:")!=std::string::npos); + BOOST_TEST(di1.find("error1")!=std::string::npos); +#endif + BOOST_TEST(di1.find("test_tag1")!=std::string::npos); + BOOST_TEST(di1.find("test_tag2")!=std::string::npos); + BOOST_TEST(di1.find("fourty-two")!=std::string::npos); +#ifndef BOOST_NO_RTTI + BOOST_TEST(di2.find("type:")!=std::string::npos); + BOOST_TEST(di2.find("error1")!=std::string::npos); +#endif + BOOST_TEST(di2.find("test_tag1")!=std::string::npos); + BOOST_TEST(di2.find("test_tag2")!=std::string::npos); + BOOST_TEST(di2.find("bad value")!=std::string::npos); + } + +void +test2( std::string const & di1, std::string const & di2 ) + { + BOOST_TEST( di1!=di2 ); + BOOST_TEST(di1.find("test_tag1")!=std::string::npos); + BOOST_TEST(di1.find("test_tag2")!=std::string::npos); + BOOST_TEST(di1.find("fourty-two")!=std::string::npos); + BOOST_TEST(di2.find("test_tag1")!=std::string::npos); + BOOST_TEST(di2.find("test_tag2")!=std::string::npos); + BOOST_TEST(di2.find("bad value")!=std::string::npos); + } + int main() { @@ -54,30 +86,26 @@ main() throw x; } catch( - boost::exception & x ) + error1 & x ) { std::string di1=boost::diagnostic_information(x); x << tagged_int1(2) << tagged_int2(2); std::string di2 = diagnostic_information(x); -#ifndef BOOST_NO_RTTI - BOOST_TEST(di1.find("type:")!=std::string::npos); - BOOST_TEST(di1.find("error1")!=std::string::npos); -#endif - BOOST_TEST(di1.find("test_tag1")!=std::string::npos); - BOOST_TEST(di1.find("test_tag2")!=std::string::npos); - BOOST_TEST(di1.find("fourty-two")!=std::string::npos); -#ifndef BOOST_NO_RTTI - BOOST_TEST(di2.find("type:")!=std::string::npos); - BOOST_TEST(di2.find("error1")!=std::string::npos); -#endif - BOOST_TEST(di2.find("test_tag1")!=std::string::npos); - BOOST_TEST(di2.find("test_tag2")!=std::string::npos); - BOOST_TEST(di2.find("bad value")!=std::string::npos); + test1(di1,di2); + } + try + { + error1 x; x << tagged_int1(42) << tagged_int2(42); + BOOST_TEST(x.what()==std::string("error1")); + throw x; } catch( - ... ) + error1 & x ) { - BOOST_TEST(false); + std::string di1=boost::current_exception_diagnostic_information(); + x << tagged_int1(2) << tagged_int2(2); + std::string di2 = current_exception_diagnostic_information(); + test1(di1,di2); } try { @@ -86,23 +114,26 @@ main() throw x; } catch( - boost::exception & x ) + error2 & x ) { std::string di1 = diagnostic_information(x); x << tagged_int1(2) << tagged_int2(2); std::string di2 = diagnostic_information(x); - BOOST_TEST( di1!=di2 ); - BOOST_TEST(di1.find("test_tag1")!=std::string::npos); - BOOST_TEST(di1.find("test_tag2")!=std::string::npos); - BOOST_TEST(di1.find("fourty-two")!=std::string::npos); - BOOST_TEST(di2.find("test_tag1")!=std::string::npos); - BOOST_TEST(di2.find("test_tag2")!=std::string::npos); - BOOST_TEST(di2.find("bad value")!=std::string::npos); + test2(di1,di2); + } + try + { + error2 x; + x << tagged_int1(42) << tagged_int2(42); + throw x; } catch( - ... ) + error2 & x ) { - BOOST_TEST(false); + std::string di1 = current_exception_diagnostic_information(); + x << tagged_int1(2) << tagged_int2(2); + std::string di2 = current_exception_diagnostic_information(); + test2(di1,di2); } return boost::report_errors(); } diff --git a/test/enable_error_info_test.cpp b/test/enable_error_info_test.cpp index e1a743d..45bbcf8 100644 --- a/test/enable_error_info_test.cpp +++ b/test/enable_error_info_test.cpp @@ -55,7 +55,7 @@ main() { #endif BOOST_TEST( boost::get_error_info(x) ); - if( boost::shared_ptr p=boost::get_error_info(x) ) + if( int const * p=boost::get_error_info(x) ) BOOST_TEST( 42==*p ); #ifdef BOOST_NO_RTTI } diff --git a/test/no_exceptions_test.cpp b/test/no_exceptions_test.cpp new file mode 100644 index 0000000..9ff31a3 --- /dev/null +++ b/test/no_exceptions_test.cpp @@ -0,0 +1,40 @@ +//Copyright (c) 2006-2008 Emil Dotchevski and Reverge Studios, Inc. + +//Distributed under the Boost Software License, Version 1.0. (See accompanying +//file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + +#define BOOST_NO_EXCEPTIONS +#include +#include +#include +#include +#include +#include + +struct my_exception: boost::exception, std::exception { }; +typedef boost::error_info my_int; + +bool called=false; + +namespace +boost + { + void + throw_exception( std::exception const & x ) + { + called=true; + std::string s=boost::diagnostic_information(x); + std::cout << s; +#ifndef BOOST_NO_RTTI + BOOST_TEST(s.find("my_tag")!=std::string::npos); +#endif + } + } + +int +main() + { + BOOST_THROW_EXCEPTION( my_exception() << my_int(42) ); + BOOST_TEST(called); + return boost::report_errors(); + } diff --git a/test/throw_exception_test.cpp b/test/throw_exception_test.cpp index 9397509..2399ec3 100644 --- a/test/throw_exception_test.cpp +++ b/test/throw_exception_test.cpp @@ -35,9 +35,9 @@ boost_throw_exception_test() catch( boost::exception & x ) { - boost::shared_ptr file=boost::get_error_info(x); - boost::shared_ptr function=boost::get_error_info(x); - boost::shared_ptr line=boost::get_error_info(x); + char const * const * file=boost::get_error_info(x); + char const * const * function=boost::get_error_info(x); + int const * line=boost::get_error_info(x); BOOST_TEST( file && *file ); BOOST_TEST( function && *function ); BOOST_TEST( line && *line==32 ); @@ -55,10 +55,10 @@ boost_throw_exception_test() catch( boost::exception & x ) { - boost::shared_ptr file=boost::get_error_info(x); - boost::shared_ptr function=boost::get_error_info(x); - boost::shared_ptr line=boost::get_error_info(x); - boost::shared_ptr data=boost::get_error_info(x); + char const * const * file=boost::get_error_info(x); + char const * const * function=boost::get_error_info(x); + int const * line=boost::get_error_info(x); + int const * data=boost::get_error_info(x); BOOST_TEST( file && *file ); BOOST_TEST( function && *function ); BOOST_TEST( line && *line==52 ); @@ -117,7 +117,7 @@ tester() { #endif BOOST_TEST(boost::get_error_info(y)); - if( boost::shared_ptr d=boost::get_error_info(y) ) + if( int const * d=boost::get_error_info(y) ) BOOST_TEST(*d==42); #ifdef BOOST_NO_RTTI } diff --git a/test/unknown_exception_test.cpp b/test/unknown_exception_test.cpp index d163802..f982ceb 100644 --- a/test/unknown_exception_test.cpp +++ b/test/unknown_exception_test.cpp @@ -56,7 +56,7 @@ main() catch( boost::unknown_exception & x ) { - if( boost::shared_ptr d=boost::get_error_info(x) ) + if( int const * d=boost::get_error_info(x) ) BOOST_TEST( 42==*d ); else BOOST_TEST(false); @@ -73,7 +73,7 @@ main() catch( boost::exception & x ) { - if( boost::shared_ptr d=boost::get_error_info(x) ) + if( int const * d=boost::get_error_info(x) ) BOOST_TEST( 42==*d ); else BOOST_TEST(false);