diff --git a/doc/boost-exception.html b/doc/boost-exception.html index dd16813..fc85cbb 100644 --- a/doc/boost-exception.html +++ b/doc/boost-exception.html @@ -25,10 +25,13 @@

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 N2179-style copying of exception objects, implemented non-intrusively and automatically by the boost::throw_exception function.

Contents

-
  1. Tutorial
    1. Transporting of Arbitrary Data to the Catch Site
    2. + diff --git a/doc/exception.html b/doc/exception.html index 1330536..a327532 100644 --- a/doc/exception.html +++ b/doc/exception.html @@ -47,6 +47,7 @@ boost current_exception
      Diagnostic Information
      diagnostic_information
      +
      Exception Types As Simple Semantic Tags
      enable_current_exception
      enable_error_info
      error_info
      @@ -55,9 +56,11 @@ boost
      exception::~exception
      get_error_info
      Integrating Boost Exception in Existing Exception Class Hierarchies
      +
      Motivation
      Transporting of Arbitrary Data to the Catch Site
      Transporting of Exceptions Between Threads
      tuple/operator<<
      +
      Using Virtual Inheritance in Exception Types
      unknown_exception
    diff --git a/doc/exception_operator_shl.html b/doc/exception_operator_shl.html index 1e55b47..89f29ae 100644 --- a/doc/exception_operator_shl.html +++ b/doc/exception_operator_shl.html @@ -47,6 +47,7 @@ boost exception::exception
    get_error_info
    Integrating Boost Exception in Existing Exception Class Hierarchies
    +
    Motivation
diff --git a/doc/exception_types_as_simple_semantic_tags.html b/doc/exception_types_as_simple_semantic_tags.html new file mode 100644 index 0000000..e60dab7 --- /dev/null +++ b/doc/exception_types_as_simple_semantic_tags.html @@ -0,0 +1,56 @@ + + + + + exception types as simple semantic tags + + + +
+
+
+
+ +

Boost Exception

+
+ + + +

Exception Types As Simple Semantic Tags

+
+

Deriving from boost::exception 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::exception, 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::exception { };
+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.

+
+ + + + +
+
+
+ + diff --git a/doc/get_error_info.html b/doc/get_error_info.html index 53c0e5c..4ebd310 100644 --- a/doc/get_error_info.html +++ b/doc/get_error_info.html @@ -49,6 +49,7 @@ boost Configuration Macros
error_info
exception
+
Motivation
diff --git a/doc/motivation.html b/doc/motivation.html new file mode 100644 index 0000000..6d1a23e --- /dev/null +++ b/doc/motivation.html @@ -0,0 +1,145 @@ + + + + + Motivation + + + +
+
+
+
+ +

Boost Exception

+
+ + + +

Motivation

+
+

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:

+
  1. To wrap an exception object it must be copied, which may result in slicing.
  2. +
  3. Wrapping is practically impossible to use in generic contexts.
  4. +
+

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 boos::exception.
  • +
  • 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::exception { };
+struct file_read_error: virtual exception_base { };
+
+typedef boost::error_info<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() << errno_code(errno);
+    ....
+    }
+

In a higher exception-neutral context, we add the file name to any exception that derives from boost::exception:

+
typedef boost::error_info<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::exception
+        do_something();
+        ....
+        }
+    else
+        throw file_open_error() << errno_code(errno);
+    }
+catch( boost::exception & e )
+    {
+    e << file_name(“foo.txt”);
+    throw;
+    }
+

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

+
catch( io_error & e )
+    {
+    std::cerr << “I/O Error!\n”;
+
+    if( shared_ptr<std::string const> fn=get_error_info<file_name>(e) )
+        std::cerr << “File name: “ << *fn << “\n”;
+
+    if( shared_ptr<int const> c=get_error_info<errno_code>(e) )
+        std::cerr << “OS says: “ << strerror(*c) << “\n”;
+    }
+
+ + + + +
+
+
+ + diff --git a/doc/name_idx.html b/doc/name_idx.html index 063c39b..77b22cc 100644 --- a/doc/name_idx.html +++ b/doc/name_idx.html @@ -23,7 +23,6 @@

B

BOOST_THROW_EXCEPTION

-

Boost Exception

b

boost/exception.hpp

boost/exception/diagnostic_information.hpp

@@ -45,6 +44,8 @@

Diagnostic Information

d

diagnostic_information

+

E

+

Exception Types As Simple Semantic Tags

e

enable_current_exception

enable_error_info

@@ -60,8 +61,9 @@

g

get_error_info

I

-

Index

Integrating Boost Exception in Existing Exception Class Hierarchies

+

M

+

Motivation

r

rethrow_exception

T

@@ -70,6 +72,8 @@

t

throw_exception

tuple/operator<<

+

U

+

Using Virtual Inheritance in Exception Types

u

unknown_exception

diff --git a/doc/source/boost-exception.reno b/doc/source/boost-exception.reno index 3647b1e..0a78736 100644 --- a/doc/source/boost-exception.reno +++ b/doc/source/boost-exception.reno @@ -39,7 +39,7 @@ - 45 + 47 0 @@ -187,639 +187,6 @@ reno_context - - - - - - 2 - 55F1164770FD778354E151EF65A3E830DA20F325F7ED20A95130A4B83FC801BF - 1282550303 - 9192 - 323 - 65D35B8A2063883A53E9D0DCC3FF8E5CA3573A58451A653CDE3003FFBEC576D3 - 1693870740 - 2195 - 3720 - - - - - - 0 - ../../../../boost/exception/exception.hpp - 0 - 0 - - - - - <string>exception</string> - - - - - - - - - 1 - 2 - (:include include:) ---- !!!See Also: (:pagelist link="backlink" except_tags="exception,member" mod="w":) - - - - - 0 - - 9 - - reno_context - - - - - - - 0 - - - - - - 1 - - - - - <string>Motivation</string> - - - - - - - - - 5 - 2 - (:include include:) (:auto also explicit=" - 1 - - 0 - - 10 - - reno_context - - - - - - - 0 - - - - - - 1 - - - - - <string>transporting of arbitrary data to the catch site</string> - - - tutorial_transporting_data - - - - - 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 - ":) - - - - - 0 - - 12 - - reno_context - - - - - - - 2 - 808CABE6CCA47C52CC9DD21911BF0B42284A5DD55AC3E665B29ED2B5F16AF7DA - 3660693492 - 8718 - 615 - E23085202D084CBB50F289988A6A592F06D923B77D0AB25D7A98A7188DF5BE3B - 1414247481 - 766 - 7382 - - - - - - 0 - ../../../../boost/exception_ptr.hpp - 0 - 0 - - - - - <string>current_exception</string> - - - - - - - - - 1 - 2 - (:include include:) (:auto also:) - - - - - 0 - - 13 - - reno_context - - - - - - - 0 - - - - - - 1 - - - - - <string>boost/exception/enable_error_info.hpp</string> - - - exception_enable_error_info_hpp - - - - - - 1 - 2 - (:include include:) (:auto also:) - - - - - 0 - - 14 - - reno_context - - - - - - - 1 - D0024B58523F5885E87F608259810B61D3BE489CEC885FFAE91118F1E43B10A4 - 399616739 - 6563 - 591 - - - - - - 0 - ../../example/example_io.cpp - 0 - 0 - - - - - <string>diagnostic_information example</string> - - - - - - - - - 0 - - - - - 0 - - 15 - - 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 - - 16 - - reno_context - - - - - - - 2 - 55F1164770FD778354E151EF65A3E830DA20F325F7ED20A95130A4B83FC801BF - 1282550303 - 9192 - 323 - DF9EA87B0140AACF4422F1B76F6A6A409C15F32858BBBA85A35981A824C56BA9 - 1137981799 - 192 - 8994 - - - - - - 0 - ../../../../boost/exception/exception.hpp - 0 - 0 - - - - - <string>enable_current_exception</string> - - - - - - - - - 1 - 2 - (:include include:) (:auto also:) - - - - - 0 - - 17 - - reno_context - - - - - - - 2 - 808CABE6CCA47C52CC9DD21911BF0B42284A5DD55AC3E665B29ED2B5F16AF7DA - 3660693492 - 8718 - 615 - 0066D4E6E6B189906E6DE04F08509F3737511701A1B1355B37511EC18E8371F4 - 2078296250 - 305 - 8150 - - - - - - 0 - ../../../../boost/exception_ptr.hpp - 0 - 0 - - - - - <string>copy_exception</string> - - - - - - - - - 1 - 2 - (:include include:) (:auto also:) - - - - - 0 - - 18 - - reno_context - - - - - - - 2 - E8AFD260BD0196A516F0E29A9FE6D09BF84B37D31E228910E3370365CAA4AB43 - 3229661566 - 3665 - 504 - BB8AF986C96801345719855FEA083AF5684FBC349F6520E150F19A6370019265 - 3731478139 - 686 - 2973 - - - - - - 0 - ../../../../boost/exception/get_error_info.hpp - 0 - 0 - - - - - <string>get_error_info</string> - - - - - - - - - 1 - 2 - (:include include:) (:auto also:) - - - - - 0 - - 19 - - 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> - - - - - - - - - 1 - 2 - (:include include:) (:auto also:) - - - - - 0 - - 20 - - 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> - - - - - - - - - 1 - 2 - (:include include:) (:auto also:) - - - - - 0 - - 21 - - 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 - - 22 - - reno_context - @@ -869,7 +236,7 @@ 0 - 23 + 9 reno_context @@ -878,118 +245,21 @@ - 1 - 187BFD2B78A0DD006717B5B06FFD465E2468F521C32A86FB793F7A68AB5417F3 - 4276724153 - 574 - 382 + 0 - 0 - ../../example/error_info_1.cpp - 0 - 0 + 1 - <string>adding of arbitrary data at the point of the throw</string> + <string>boost/exception/enable_current_exception.hpp</string> - adding_data_at_throw - - - - - - 0 - - - - - 0 - - 24 - - 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 - - 25 - - reno_context - - - - - - - 2 - 808CABE6CCA47C52CC9DD21911BF0B42284A5DD55AC3E665B29ED2B5F16AF7DA - 3660693492 - 8718 - 615 - F86EB07D04CD0D0645080D1121DA899746D0C45137E17E1D9BE605E75396F047 - 1983537541 - 1346 - 148 - - - - - - 0 - ../../../../boost/exception_ptr.hpp - 0 - 0 - - - - - <string>exception_ptr</string> - - - + exception_enable_current_exception_hpp @@ -1004,7 +274,7 @@ 0 - 26 + 10 reno_context @@ -1013,11 +283,15 @@ - 1 + 2 55F1164770FD778354E151EF65A3E830DA20F325F7ED20A95130A4B83FC801BF 1282550303 9192 323 + 65D35B8A2063883A53E9D0DCC3FF8E5CA3573A58451A653CDE3003FFBEC576D3 + 1693870740 + 2195 + 3720 @@ -1031,10 +305,10 @@ - <string>boost/exception/exception.hpp</string> + <string>exception</string> - exception_exception_hpp + @@ -1042,14 +316,14 @@ 1 2 - (:include include:) (:auto also:) + (:include include:) ---- !!!See Also: (:pagelist link="backlink" except_tags="exception,member" mod="w":) 0 - 27 + 11 reno_context @@ -1069,764 +343,23 @@ - <string>Index</string> + <string>Motivation</string> - name_idx + motivation - 1 + 5 2 - (:auto !:) (:pagelist fmt="index" except_tags="index,noindex" mod="w":) - - - - - 0 - - 28 - - reno_context - - - - - - - 2 - 3D64A3F5639045A59A0CD362AD4C531ECC763B7C523E284DCBFBACAAF5F681C3 - 4142572795 - 1596 - 462 - 6FE1F0AF570A010E8FDA1647DE61E0CC3AA979C8A8638722DAACDF8FBC4790D2 - 1246830037 - 1023 - 567 - - - - - - 0 - ../../../../boost/exception/diagnostic_information.hpp - 0 - 0 - - - - - <string>diagnostic_information</string> - - - - - - - - - 1 - 2 - (:include include:) (:auto also:) - - - - - 0 - - 29 - - reno_context - - - - - - - 0 - - - - - - 1 - - - - - <string>transporting of exceptions between threads</string> - - - tutorial_exception_ptr - - - - - - 1 - 2 - (:include include:) (:auto also:) - - - - - 0 - - 30 - - reno_context - - - - - - - 2 - 612485E090D76B2CC43C1A296F813075BA165C2496082E78E939F10B3DA8E09A - 1770110914 - 587 - 1497 - 60F3F48B87487FA6E0D2CCC0750AF435CC92CEC80BBBF609AC71295031AADD0D - 3929437933 - 361 - 213 - - - - - - 0 - ../../../../boost/throw_exception.hpp - 0 - 0 - - - - - <string>throw_exception</string> - - - - - - - - - 1 - 2 - (:include include:) (:auto also:) - - - - - 0 - - 31 - - reno_context - - - - - - - 2 - 00067869F918D0E8905D8A464C17FA9DAD9F497B3A172EB360239EEB5778A206 - 3465219615 - 4025 - 518 - 6E325144EF4F41FA3A225EB30729101382C4E99B3D6160E307311E4B4E641010 - 1097215175 - 161 - 240 - - - - - - 0 - ../../../../boost/exception/info.hpp - 0 - 0 - - - - - <string>error_info::error_info</string> - - - - - - - - - 1 - 2 - (:include include:) (:auto also:) - - - - - 0 - - 32 - - reno_context - - - - - - - 2 - F7633FDCF6615C0199645701EE6E7ACE5CBCD7A7CF6838573791E91ABB3C09F2 - 1668435395 - 1332 - 396 - A1F443AF571973A12005D2F7D4AE09A32AAF686FEEAE272EC21512A65EB943E8 - 3879093659 - 1300 - 26 - - - - - - 0 - ../../../../boost/exception/info_tuple.hpp - 0 - 0 - - - - - <string>tuple/operator<<</string> - - - - - - - - - 1 - 2 - (:include include:) (:auto also:) - - - - - 0 - - 33 - - reno_context - - - - - - - 0 - - - - - - 1 - - - - - <string>boost exception</string> - - - boost-exception - - - - - - 121 - 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 + (:include include:) (:auto also explicit=" 1 0 - -29 - - - 2 - |copying:) of exception objects, implemented non-intrusively and automatically by the boost::(:link - 1 - - 0 - - -30 - - - 2 - :) function. !!Contents #(:link - 1 - - 0 - - -9 - - - 2 - :) #Tutorial ##(:link - 1 - - 0 - - -10 - - - 2 - mod="w":) ##(:link - 1 - - 0 - - -7 - - - 2 - mod="w":) ##(:link - 1 - - 0 - - -11 - - - 2 - mod="w":) ##(:link - 1 - - 0 - - -29 - - - 2 - mod="w":) #Documentation ##Class (:link - 1 - - 0 - - -8 - - - 2 - :) ##Transporting of Arbitrary Data to the Catch Site ###(:link - 1 - - 0 - - -19 - - - 2 - :) ###(:link - 1 - - 0 - - -15 - - - 2 - :) ###(:link - 1 - - 0 - - -32 - - - 2 - :) ###(:link - 1 - - 0 - - -18 - - - 2 - :) ###(:link - 1 - - 0 - - 34 - - reno_context - - - - - - - 2 - 55F1164770FD778354E151EF65A3E830DA20F325F7ED20A95130A4B83FC801BF - 1282550303 - 9192 - 323 - F3FB15CD82336271C6E875BC620385322777D16F0B7C233300783CE35710CCBF - 3292878997 - 282 - 7305 - - - - - - 0 - ../../../../boost/exception/exception.hpp - 0 - 0 - - - - - <string>enable_error_info</string> - - - - - - - - 2 - :) ##(:link http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2179.html|N2179:) Transporting of Exceptions between Threads ###(:link - 1 - - 0 - - -25 - - - 2 - :) ###(:link - 1 - - 0 - - -16 - - - 2 - :) ###(:link - 1 - - 0 - - -12 - - - 2 - :) ###(:link - 1 - - 0 - - -17 - - - 2 - :) ###(:link - 1 - - 0 - - 35 - - reno_context - - - - - - - 2 - 808CABE6CCA47C52CC9DD21911BF0B42284A5DD55AC3E665B29ED2B5F16AF7DA - 3660693492 - 8718 - 615 - 0E9DF8366080712A816BE91ABCEF1E2044145B63D75B0B995B537900F378189E - 1069696031 - 255 - 8457 - - - - - - 0 - ../../../../boost/exception_ptr.hpp - 0 - 0 - - - - - <string>rethrow_exception</string> - - - - - - - - 2 - :) ###(:link - 1 - - 0 - - 36 - - reno_context - - - - - - - 2 - 808CABE6CCA47C52CC9DD21911BF0B42284A5DD55AC3E665B29ED2B5F16AF7DA - 3660693492 - 8718 - 615 - DA033132CFA8F85C147C01F51FF7CF7399CF7D32D412F730EA3219CDAC608C72 - 3830952485 - 712 - 1496 - - - - - - 0 - ../../../../boost/exception_ptr.hpp - 0 - 0 - - - - - <string>unknown_exception</string> - - - - - - - - 2 - :) ##(:link - 1 - - 0 - - -28 - - - 2 - :) ##(:link - 1 - - 0 - - -30 - - - 2 - :), (:link - 1 - - 0 - - 37 - - reno_context - - - - - - - 1 - 17FF6C63843EE64ED66CB038DD95B4C4D6BA1B0FD36B27BEFD84A909161D2853 - 1237535165 - 231 - 1186 - - - - - - 0 - ../../../../boost/throw_exception.hpp - 0 - 0 - - - - - <string>BOOST_THROW_EXCEPTION</string> - - - - - - - - 2 - :) ##(:link - 1 - - 0 - - 38 - - 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 - - 39 - - reno_context - - - - - - - 1 - F647827E95C64B626A8E3751AD4E4D21237DD17482EEA6DB93A16A2C6AC79E87 - 527078204 - 446 - 227 - - - - - - 0 - ../../../../boost/exception.hpp - 0 - 0 - - - - - <string>boost/exception.hpp</string> - - - exception_hpp - - - - - 2 - :) ###(:link - 1 - - 0 - - 40 - - 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 - - 41 + 12 reno_context @@ -1846,84 +379,21 @@ - <string>boost/exception/enable_current_exception.hpp</string> + <string>exception types as simple semantic tags</string> - exception_enable_current_exception_hpp + 2 - :) ###(:link + 1 0 - -13 - - - 2 - :) ###(:link - 1 - - 0 - - 42 - - 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 - - -26 - - - 2 - :) ###(:link - 1 - - 0 - - 43 + 13 reno_context @@ -1933,471 +403,40 @@ 1 - F6C6B72C2CDEBC5E3EAA924F637563A8F8A95684AF6EEF39FE2260C86C77F531 - 2151348977 - 3846 - 323 + D9B8E6AA12A4F33953B1A961FA590C5A3840234B6531CA8C04AC985AD5800835 + 2432554768 + 702 + 408 0 - ../../../../boost/exception/get_error_info.hpp + ../../example/enable_error_info.cpp 0 0 - <string>boost/exception/get_error_info.hpp</string> + <string>integrating boost exception in existing exception class hierarchies</string> - exception_get_error_info_hpp + tutorial_enable_error_info 2 - :) ###(:link - 1 - - 0 - - 44 - - 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 - - -5 - - - 2 - :) ###(:link - 1 - - 0 - - 45 - - reno_context - - - - - - - 1 - FBC69CDA5E19FA40270F3855A8B99B2F77572439353F9DC5D15386F3520BC616 - 1405483403 - 8882 - 451 - - - - - - 0 - ../../../../boost/exception_ptr.hpp - 0 - 0 - - - - - <string>boost/exception_ptr.hpp</string> - - - exception_cloning_hpp - - - - - 2 - :) ###(:link - 1 - - 0 - - 46 - - 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 - - -27 - - - 2 - :) !!Synopsis `#include <(:link - 1 - - 0 - - -39 - - - 2 - :)> [@namespace boost { (:include - 1 - - 0 - - -26 - - - 2 - api pre_indent="4":) (:include - 1 - - 0 - - -44 - - - 2 - api pre_indent="4":) (:include - 1 - - 0 - - -5 - - - 2 - api pre_indent="4":) (:include - 1 - - 0 - - -13 - - - 2 - api pre_indent="4":) (:include - 1 - - 0 - - -40 - - - 2 - api pre_indent="4":) (:include - 1 - - 0 - - -45 - - - 2 - api pre_indent="4":) (:include - 1 - - 0 - - -41 - - - 2 - api pre_indent="4":) }@] `#include <(:link - 1 - - 0 - - -46 - - - 2 - :)> [@(:include - 1 - - 0 - - -46 - - - 2 - api:)@] !!Class exception (:include - 1 - - 0 - - -8 - - - 2 - :) !!Transporting of Arbitrary Data to the Catch Site (:include - 1 - - 0 - - -19 - - - 2 - :) (:include - 1 - - 0 - - -15 - - - 2 - :) (:include - 1 - - 0 - - -32 - - - 2 - :) (:include - 1 - - 0 - - -18 - - - 2 - :) (:include - 1 - - 0 - - -34 - - - 2 - :) !!Transporting of Exceptions between Threads (:include - 1 - - 0 - - -25 - - - 2 - :) (:include - 1 - - 0 - - -16 - - - 2 - :) (:include - 1 - - 0 - - -12 - - - 2 - :) (:include - 1 - - 0 - - -17 - - - 2 - :) (:include - 1 - - 0 - - -35 - - - 2 - :) (:include - 1 - - 0 - - -36 - - - 2 - :) !!Printing Diagnostic Information (:include - 1 - - 0 - - -28 - - - 2 - :) !!Throwing Exceptions (:include - 1 - - 0 - - -30 - - - 2 - :) (:include - 1 - - 0 - - -37 - - - 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. + ":) 0 - -36 - - - - 1 - 2 - (:include include:) (:auto also:) - - - - - 0 - - -37 - - - - 1 - 2 - (:include include:) (:pagelist link="backlink":) - - - - - 0 - - -11 - - - - 1 - 2 - (:include include:) (:auto also:) - - - - - 0 - - -45 - - - - 1 - 2 - (:include include:) (:auto also:) - - - - - 0 - - -43 - - - - 1 - 2 - (:include include:) (:auto also:) - - - - - 0 - - 47 + 14 reno_context @@ -2406,41 +445,36 @@ - 1 - E444EE9697EEADFDE0767E1D0242FC0E70D98E61FB1F0FFA099648DE509B82F3 - 94503238 - 773 - 374 + 0 - 0 - ../../example/info_tuple.cpp - 0 - 0 + 1 - <string>adding grouped data to exceptions</string> + <string>transporting of arbitrary data to the catch site</string> - grouping_data + tutorial_transporting_data - 0 + 1 + 2 + (:include include:) (:auto also:) 0 - -46 + -13 @@ -2453,76 +487,7 @@ 0 - 48 - - 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 - - -41 - - - - 1 - 2 - (:include include:) (:auto also:) - - - - - 0 - - -40 - - - - 1 - 2 - (:include include:) (:auto also:) - - - - - 0 - - 49 + 15 reno_context @@ -2575,7 +540,43 @@ 0 - -35 + 16 + + reno_context + + + + + + + 2 + 808CABE6CCA47C52CC9DD21911BF0B42284A5DD55AC3E665B29ED2B5F16AF7DA + 3660693492 + 8718 + 487 + E23085202D084CBB50F289988A6A592F06D923B77D0AB25D7A98A7188DF5BE3B + 1414247481 + 766 + 7382 + + + + + + 0 + ../../../../boost/exception_ptr.hpp + 0 + 0 + + + + + <string>current_exception</string> + + + + + @@ -2588,7 +589,32 @@ 0 - -10 + 17 + + reno_context + + + + + + + 0 + + + + + + 1 + + + + + <string>boost/exception/enable_error_info.hpp</string> + + + exception_enable_error_info_hpp + + @@ -2597,6 +623,1910 @@ (:include include:) (:auto also:) + + + 0 + + 18 + + reno_context + + + + + + + 1 + D0024B58523F5885E87F608259810B61D3BE489CEC885FFAE91118F1E43B10A4 + 399616739 + 6563 + 591 + + + + + + 0 + ../../example/example_io.cpp + 0 + 0 + + + + + <string>diagnostic_information example</string> + + + + + + + + + 0 + + + + + 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 + + reno_context + + + + + + + 2 + 55F1164770FD778354E151EF65A3E830DA20F325F7ED20A95130A4B83FC801BF + 1282550303 + 9192 + 323 + DF9EA87B0140AACF4422F1B76F6A6A409C15F32858BBBA85A35981A824C56BA9 + 1137981799 + 192 + 8994 + + + + + + 0 + ../../../../boost/exception/exception.hpp + 0 + 0 + + + + + <string>enable_current_exception</string> + + + + + + + + + 1 + 2 + (:include include:) (:auto also:) + + + + + 0 + + 21 + + reno_context + + + + + + + 2 + 808CABE6CCA47C52CC9DD21911BF0B42284A5DD55AC3E665B29ED2B5F16AF7DA + 3660693492 + 8718 + 487 + 0066D4E6E6B189906E6DE04F08509F3737511701A1B1355B37511EC18E8371F4 + 2078296250 + 305 + 8150 + + + + + + 0 + ../../../../boost/exception_ptr.hpp + 0 + 0 + + + + + <string>copy_exception</string> + + + + + + + + + 1 + 2 + (:include include:) (:auto also:) + + + + + 0 + + 22 + + reno_context + + + + + + + 2 + E8AFD260BD0196A516F0E29A9FE6D09BF84B37D31E228910E3370365CAA4AB43 + 3229661566 + 3665 + 504 + BB8AF986C96801345719855FEA083AF5684FBC349F6520E150F19A6370019265 + 3731478139 + 686 + 2973 + + + + + + 0 + ../../../../boost/exception/get_error_info.hpp + 0 + 0 + + + + + <string>get_error_info</string> + + + + + + + + + 1 + 2 + (:include include:) (:auto also:) + + + + + 0 + + 23 + + 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> + + + + + + + + + 1 + 2 + (:include include:) (:auto also:) + + + + + 0 + + 24 + + 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> + + + + + + + + + 1 + 2 + (:include include:) (:auto also:) + + + + + 0 + + 25 + + reno_context + + + + + + + 1 + F6C6B72C2CDEBC5E3EAA924F637563A8F8A95684AF6EEF39FE2260C86C77F531 + 2151348977 + 3846 + 323 + + + + + + 0 + ../../../../boost/exception/get_error_info.hpp + 0 + 0 + + + + + <string>boost/exception/get_error_info.hpp</string> + + + exception_get_error_info_hpp + + + + + + 1 + 2 + (:include include:) (:auto also:) + + + + + 0 + + 26 + + 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 + + 27 + + 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 + + 28 + + reno_context + + + + + + + 1 + 187BFD2B78A0DD006717B5B06FFD465E2468F521C32A86FB793F7A68AB5417F3 + 4276724153 + 574 + 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 + + 29 + + 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 + + 30 + + reno_context + + + + + + + 2 + 808CABE6CCA47C52CC9DD21911BF0B42284A5DD55AC3E665B29ED2B5F16AF7DA + 3660693492 + 8718 + 487 + F86EB07D04CD0D0645080D1121DA899746D0C45137E17E1D9BE605E75396F047 + 1983537541 + 1346 + 148 + + + + + + 0 + ../../../../boost/exception_ptr.hpp + 0 + 0 + + + + + <string>exception_ptr</string> + + + + + + + + + 1 + 2 + (:include include:) (:auto also:) + + + + + 0 + + 31 + + reno_context + + + + + + + 1 + 55F1164770FD778354E151EF65A3E830DA20F325F7ED20A95130A4B83FC801BF + 1282550303 + 9192 + 323 + + + + + + 0 + ../../../../boost/exception/exception.hpp + 0 + 0 + + + + + <string>boost/exception/exception.hpp</string> + + + exception_exception_hpp + + + + + + 1 + 2 + (:include include:) (:auto also:) + + + + + 0 + + 32 + + reno_context + + + + + + + 0 + + + + + + 1 + + + + + <string>Index</string> + + + name_idx + + + + + + 1 + 2 + (:auto !:) (:pagelist fmt="index" except_tags="index noindex" mod="w":) + + + + + 0 + + 33 + + reno_context + + + + + + + 2 + 3D64A3F5639045A59A0CD362AD4C531ECC763B7C523E284DCBFBACAAF5F681C3 + 4142572795 + 1596 + 462 + 6FE1F0AF570A010E8FDA1647DE61E0CC3AA979C8A8638722DAACDF8FBC4790D2 + 1246830037 + 1023 + 567 + + + + + + 0 + ../../../../boost/exception/diagnostic_information.hpp + 0 + 0 + + + + + <string>diagnostic_information</string> + + + + + + + + + 1 + 2 + (:include include:) (:auto also:) + + + + + 0 + + 34 + + reno_context + + + + + + + 0 + + + + + + 1 + + + + + <string>transporting of exceptions between threads</string> + + + tutorial_exception_ptr + + + + + + 1 + 2 + (:include include:) (:auto also:) + + + + + 0 + + 35 + + reno_context + + + + + + + 2 + 612485E090D76B2CC43C1A296F813075BA165C2496082E78E939F10B3DA8E09A + 1770110914 + 587 + 1497 + 60F3F48B87487FA6E0D2CCC0750AF435CC92CEC80BBBF609AC71295031AADD0D + 3929437933 + 361 + 213 + + + + + + 0 + ../../../../boost/throw_exception.hpp + 0 + 0 + + + + + <string>throw_exception</string> + + + + + + + + + 1 + 2 + (:include include:) (:auto also:) + + + + + 0 + + 36 + + reno_context + + + + + + + 2 + 808CABE6CCA47C52CC9DD21911BF0B42284A5DD55AC3E665B29ED2B5F16AF7DA + 3660693492 + 8718 + 487 + DA033132CFA8F85C147C01F51FF7CF7399CF7D32D412F730EA3219CDAC608C72 + 3830952485 + 712 + 1496 + + + + + + 0 + ../../../../boost/exception_ptr.hpp + 0 + 0 + + + + + <string>unknown_exception</string> + + + + + + + + + 1 + 2 + (:include include:) (:auto also:) + + + + + 0 + + 37 + + reno_context + + + + + + + 2 + F7633FDCF6615C0199645701EE6E7ACE5CBCD7A7CF6838573791E91ABB3C09F2 + 1668435395 + 1332 + 396 + A1F443AF571973A12005D2F7D4AE09A32AAF686FEEAE272EC21512A65EB943E8 + 3879093659 + 1300 + 26 + + + + + + 0 + ../../../../boost/exception/info_tuple.hpp + 0 + 0 + + + + + <string>tuple/operator<<</string> + + + + + + + + + 1 + 2 + (:include include:) (:auto also:) + + + + + 0 + + 38 + + reno_context + + + + + + + 2 + 00067869F918D0E8905D8A464C17FA9DAD9F497B3A172EB360239EEB5778A206 + 3465219615 + 4025 + 518 + 6E325144EF4F41FA3A225EB30729101382C4E99B3D6160E307311E4B4E641010 + 1097215175 + 161 + 240 + + + + + + 0 + ../../../../boost/exception/info.hpp + 0 + 0 + + + + + <string>error_info::error_info</string> + + + + + + + + + 1 + 2 + (:include include:) (:auto also:) + + + + + 0 + + 39 + + reno_context + + + + + + + 0 + + + + + + 1 + + + + + <string>boost exception</string> + + + boost-exception + + + + + + 125 + 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 + + -34 + + + 2 + |copying:) of exception objects, implemented non-intrusively and automatically by the boost::(:link + 1 + + 0 + + -35 + + + 2 + :) function. !!Contents #(:link + 1 + + 0 + + -11 + + + 2 + :) #Tutorial ##(:link + 1 + + 0 + + -14 + + + 2 + mod="w":) ##(:link + 1 + + 0 + + -7 + + + 2 + mod="w":) ##(:link + 1 + + 0 + + -13 + + + 2 + mod="w":) ##(:link + 1 + + 0 + + -34 + + + 2 + mod="w":) ##(:link + 1 + + 0 + + -12 + + + 2 + mod="w":) ##(:link + 1 + + 0 + + 40 + + reno_context + + + + + + + 0 + + + + + + 1 + + + + + <string>using virtual inheritance in exception types</string> + + + + + + + + 2 + mod="w":) #Documentation ##Class (:link + 1 + + 0 + + -10 + + + 2 + :) ##Transporting of Arbitrary Data to the Catch Site ###(:link + 1 + + 0 + + -23 + + + 2 + :) ###(:link + 1 + + 0 + + -19 + + + 2 + :) ###(:link + 1 + + 0 + + -37 + + + 2 + :) ###(:link + 1 + + 0 + + -22 + + + 2 + :) ###(:link + 1 + + 0 + + 41 + + reno_context + + + + + + + 2 + 55F1164770FD778354E151EF65A3E830DA20F325F7ED20A95130A4B83FC801BF + 1282550303 + 9192 + 323 + F3FB15CD82336271C6E875BC620385322777D16F0B7C233300783CE35710CCBF + 3292878997 + 282 + 7305 + + + + + + 0 + ../../../../boost/exception/exception.hpp + 0 + 0 + + + + + <string>enable_error_info</string> + + + + + + + + 2 + :) ##(:link http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2179.html|N2179:) Transporting of Exceptions between Threads ###(:link + 1 + + 0 + + -30 + + + 2 + :) ###(:link + 1 + + 0 + + -20 + + + 2 + :) ###(:link + 1 + + 0 + + -16 + + + 2 + :) ###(:link + 1 + + 0 + + -21 + + + 2 + :) ###(:link + 1 + + 0 + + 42 + + 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 + + -36 + + + 2 + :) ##(:link + 1 + + 0 + + -33 + + + 2 + :) ##(:link + 1 + + 0 + + -35 + + + 2 + :), (:link + 1 + + 0 + + 43 + + reno_context + + + + + + + 1 + 17FF6C63843EE64ED66CB038DD95B4C4D6BA1B0FD36B27BEFD84A909161D2853 + 1237535165 + 231 + 1186 + + + + + + 0 + ../../../../boost/throw_exception.hpp + 0 + 0 + + + + + <string>BOOST_THROW_EXCEPTION</string> + + + + + + + + 2 + :) ##(:link + 1 + + 0 + + 44 + + 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 + + 45 + + reno_context + + + + + + + 1 + F647827E95C64B626A8E3751AD4E4D21237DD17482EEA6DB93A16A2C6AC79E87 + 527078204 + 446 + 227 + + + + + + 0 + ../../../../boost/exception.hpp + 0 + 0 + + + + + <string>boost/exception.hpp</string> + + + exception_hpp + + + + + 2 + :) ###(:link + 1 + + 0 + + 46 + + 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 + + -9 + + + 2 + :) ###(:link + 1 + + 0 + + -17 + + + 2 + :) ###(:link + 1 + + 0 + + -26 + + + 2 + :) ###(:link + 1 + + 0 + + -31 + + + 2 + :) ###(:link + 1 + + 0 + + -25 + + + 2 + :) ###(:link + 1 + + 0 + + 47 + + 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 + + -5 + + + 2 + :) ###(:link + 1 + + 0 + + 48 + + 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 + + 49 + + 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 + + -32 + + + 2 + :) !!Synopsis `#include <(:link + 1 + + 0 + + -45 + + + 2 + :)> [@namespace boost { (:include + 1 + + 0 + + -31 + + + 2 + api pre_indent="4":) (:include + 1 + + 0 + + -47 + + + 2 + api pre_indent="4":) (:include + 1 + + 0 + + -5 + + + 2 + api pre_indent="4":) (:include + 1 + + 0 + + -17 + + + 2 + api pre_indent="4":) (:include + 1 + + 0 + + -46 + + + 2 + api pre_indent="4":) (:include + 1 + + 0 + + -48 + + + 2 + api pre_indent="4":) (:include + 1 + + 0 + + -9 + + + 2 + api pre_indent="4":) }@] `#include <(:link + 1 + + 0 + + -49 + + + 2 + :)> [@(:include + 1 + + 0 + + -49 + + + 2 + api:)@] !!Class exception (:include + 1 + + 0 + + -10 + + + 2 + :) !!Transporting of Arbitrary Data to the Catch Site (:include + 1 + + 0 + + -23 + + + 2 + :) (:include + 1 + + 0 + + -19 + + + 2 + :) (:include + 1 + + 0 + + -37 + + + 2 + :) (:include + 1 + + 0 + + -22 + + + 2 + :) (:include + 1 + + 0 + + -41 + + + 2 + :) !!Transporting of Exceptions between Threads (:include + 1 + + 0 + + -30 + + + 2 + :) (:include + 1 + + 0 + + -20 + + + 2 + :) (:include + 1 + + 0 + + -16 + + + 2 + :) (:include + 1 + + 0 + + -21 + + + 2 + :) (:include + 1 + + 0 + + -42 + + + 2 + :) (:include + 1 + + 0 + + -36 + + + 2 + :) !!Printing Diagnostic Information (:include + 1 + + 0 + + -33 + + + 2 + :) !!Throwing Exceptions (:include + 1 + + 0 + + -35 + + + 2 + :) (:include + 1 + + 0 + + -43 + + + 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. + + 0 @@ -2607,14 +2537,27 @@ 1 2 - (:include include:) (:auto also:) + (:include include:) (:auto also:) 0 - -39 + -43 + + + + 1 + 2 + (:include include:) (:pagelist link="backlink":) + + + + + 0 + + -41 @@ -2640,7 +2583,7 @@ 0 - -38 + -45 @@ -2653,7 +2596,158 @@ 0 - -34 + -46 + + + + 1 + 2 + (:include include:) (:auto also:) + + + + + 0 + + -47 + + + + 1 + 2 + (:include include:) (:auto also:) + + + + + 0 + + -48 + + + + 1 + 2 + (:include include:) (:auto also:) + + + + + 0 + + -49 + + + + 1 + 2 + (:include include:) (:auto also:) + + + + + 0 + + 50 + + reno_context + + + + + + + 1 + E444EE9697EEADFDE0767E1D0242FC0E70D98E61FB1F0FFA099648DE509B82F3 + 94503238 + 773 + 374 + + + + + + 0 + ../../example/info_tuple.cpp + 0 + 0 + + + + + <string>adding grouped data to exceptions</string> + + + grouping_data + + + + + + 0 + + + + + 0 + + 51 + + 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 + + -12 + + + + 1 + 2 + (:include include:) (:auto also:) + + + + + 0 + + -40 @@ -2669,13 +2763,13 @@ def - 50 + 52 reno_layer - 45 + 47 0 @@ -2716,6 +2810,28 @@ -8 + + 0 + + + + + 0 + + -9 + + + + 0 + + + + + 0 + + -10 + + 7 2 @@ -2724,7 +2840,7 @@ 0 - -8 + -10 2 @@ -2733,7 +2849,7 @@ 0 - -49 + -15 2 @@ -2753,29 +2869,7 @@ 0 - -9 - - - - 0 - - - - - 0 - - -12 - - - - 0 - - - - - 0 - - -13 + -11 @@ -2793,6 +2887,17 @@ 0 + + + 0 + + -13 + + + + 0 + + 0 @@ -2845,45 +2950,7 @@ - 9 - 2 - [@template <class Tag,class T> class (:link - 1 - - 0 - - -19 - - - 2 - :) { public: (:include - 1 - - 0 - - -22 - - - 2 - decl pre_indent="4":) (:include - 1 - - 0 - - -31 - - - 2 - decl pre_indent="4":) (:include - 1 - - 0 - - -20 - - - 2 - decl pre_indent="4":) };@] + 0 @@ -2927,7 +2994,45 @@ - 0 + 9 + 2 + [@template <class Tag,class T> class (:link + 1 + + 0 + + -23 + + + 2 + :) { public: (:include + 1 + + 0 + + -8 + + + 2 + decl pre_indent="4":) (:include + 1 + + 0 + + -38 + + + 2 + decl pre_indent="4":) (:include + 1 + + 0 + + -24 + + + 2 + decl pre_indent="4":) };@] @@ -3040,6 +3145,28 @@ 0 + + + 0 + + -34 + + + + 0 + + + + + 0 + + -35 + + + + 0 + + 0 @@ -3066,128 +3193,7 @@ 0 - -11 - - - - 0 - - - - - 0 - - -45 - - - - 0 - - - - - 0 - - -43 - - - - 0 - - - - - 0 - - -47 - - - - 0 - - - - - 0 - - -46 - - - - 0 - - - - - 0 - - -48 - - - - 0 - - - - - 0 - - -41 - - - - 0 - - - - - 0 - - -40 - - - - 0 - - - - - 0 - - -49 - - - - 0 - - - - - 0 - - -35 - - - - 0 - - - - - 0 - - -10 - - - - 0 - - - - - 0 - - -44 + -38 @@ -3205,6 +3211,39 @@ 0 + + + 0 + + -44 + + + + 0 + + + + + 0 + + -43 + + + + 0 + + + + + 0 + + -41 + + + + 0 + + 0 @@ -3220,7 +3259,7 @@ 0 - -38 + -45 @@ -3231,7 +3270,84 @@ 0 - -34 + -46 + + + + 0 + + + + + 0 + + -47 + + + + 0 + + + + + 0 + + -48 + + + + 0 + + + + + 0 + + -49 + + + + 0 + + + + + 0 + + -50 + + + + 0 + + + + + 0 + + -51 + + + + 0 + + + + + 0 + + -12 + + + + 0 + + + + + 0 + + -40 @@ -3245,13 +3361,13 @@ api - 51 + 53 reno_layer - 45 + 47 0 @@ -3267,7 +3383,7 @@ 0 - -32 + -37 2 @@ -3314,6 +3430,28 @@ -9 + + 3 + 2 + [@(:include + 1 + + 0 + + -20 + + + 2 + decl:)@] + + + + + 0 + + -10 + + 0 @@ -3322,7 +3460,18 @@ 0 - -12 + -11 + + + + 0 + + + + + 0 + + -14 @@ -3336,28 +3485,6 @@ -13 - - 3 - 2 - [@(:include - 1 - - 0 - - -34 - - - 2 - decl:)@] - - - - - 0 - - -14 - - 0 @@ -3392,7 +3519,18 @@ - 0 + 3 + 2 + [@(:include + 1 + + 0 + + -41 + + + 2 + decl:)@] @@ -3480,7 +3618,18 @@ - 0 + 3 + 2 + [@(:include + 1 + + 0 + + -22 + + + 2 + decl:)@] @@ -3491,54 +3640,18 @@ - 11 + 3 2 [@(:include 1 0 - -8 + -23 2 - def:) (:include - 1 - - 0 - - -19 - - - 2 - decl:) typedef (:link - 1 - - 0 - - -19 - - - 2 - :)<struct tag_throw_function,char const *> throw_function; typedef (:link - 1 - - 0 - - -19 - - - 2 - :)<struct tag_throw_file,char const *> throw_file; typedef (:link - 1 - - 0 - - -19 - - - 2 - :)<struct tag_throw_line,int> throw_line;@] + decl:)@] @@ -3593,7 +3706,54 @@ - 0 + 11 + 2 + [@(:include + 1 + + 0 + + -10 + + + 2 + def:) (:include + 1 + + 0 + + -23 + + + 2 + decl:) typedef (:link + 1 + + 0 + + -23 + + + 2 + :)<struct tag_throw_function,char const *> throw_function; typedef (:link + 1 + + 0 + + -23 + + + 2 + :)<struct tag_throw_file,char const *> throw_file; typedef (:link + 1 + + 0 + + -23 + + + 2 + :)<struct tag_throw_line,int> throw_line;@] @@ -3618,6 +3778,28 @@ 0 + + + 0 + + -34 + + + + 0 + + + + + 0 + + -35 + + + + 0 + + 0 @@ -3644,7 +3826,62 @@ 0 - -11 + -38 + + + + 0 + + + + + 0 + + -39 + + + + 0 + + + + + 0 + + -44 + + + + 0 + + + + + 0 + + -43 + + + + 0 + + + + + 0 + + -41 + + + + 0 + + + + + 0 + + -42 @@ -3658,6 +3895,135 @@ -45 + + 15 + 2 + [@#include <(:link + 1 + + 0 + + -46 + + + 2 + :)> #include <(:link + 1 + + 0 + + -26 + + + 2 + :)> #include <(:link + 1 + + 0 + + -31 + + + 2 + :)> #include <(:link + 1 + + 0 + + -25 + + + 2 + :)> #include <(:link + 1 + + 0 + + -47 + + + 2 + :)> #include <(:link + 1 + + 0 + + -5 + + + 2 + :)> #include <(:link + 1 + + 0 + + -48 + + + 2 + :)>@] + + + + + 0 + + -46 + + + + 3 + 2 + [@(:include + 1 + + 0 + + -33 + + + 2 + decl:)@] + + + + + 0 + + -47 + + + + 5 + 2 + [@(:include + 1 + + 0 + + -23 + + + 2 + def:) (:include + 1 + + 0 + + -19 + + + 2 + decl:)@] + + + + + 0 + + -48 + + 11 2 @@ -3672,97 +4038,6 @@ 2 decl:) (:include 1 - - 0 - - -25 - - - 2 - decl:) (:include - 1 - - 0 - - -17 - - - 2 - decl:) (:include - 1 - - 0 - - -12 - - - 2 - decl:) (:include - 1 - - 0 - - -35 - - - 2 - decl:)@] - - - - - 0 - - -43 - - - - 3 - 2 - [@(:include - 1 - - 0 - - -18 - - - 2 - decl:)@] - - - - - 0 - - -47 - - - - 0 - - - - - 0 - - -46 - - - - 5 - 2 - [@(:include - 1 - - 0 - - -37 - - - 2 - decl:) namespace boost { (:include - 1 0 @@ -3770,31 +4045,16 @@ 2 - decl:) }@] - - - - - 0 - - -48 - - - - 0 - - - - - 0 - - -41 - - - - 3 + decl:) (:include + 1 + + 0 + + -21 + + 2 - [@(:include + decl:) (:include 1 0 @@ -3803,25 +4063,12 @@ 2 - decl:)@] - - - - - 0 - - -40 - - - - 3 - 2 - [@(:include + decl:) (:include 1 0 - -28 + -42 2 @@ -3835,102 +4082,11 @@ -49 - - 0 - - - - - 0 - - -35 - - - - 0 - - - - - 0 - - -10 - - - - 0 - - - - - 0 - - -44 - - 5 2 [@(:include 1 - - 0 - - -19 - - - 2 - def:) (:include - 1 - - 0 - - -15 - - - 2 - decl:)@] - - - - - 0 - - -39 - - - - 15 - 2 - [@#include <(:link - 1 - - 0 - - -40 - - - 2 - :)> #include <(:link - 1 - - 0 - - -42 - - - 2 - :)> #include <(:link - 1 - - 0 - - -26 - - - 2 - :)> #include <(:link - 1 0 @@ -3938,63 +4094,23 @@ 2 - :)> #include <(:link + decl:) namespace boost { (:include 1 0 - -44 + -35 2 - :)> #include <(:link - 1 - - 0 - - -5 - - - 2 - :)> #include <(:link - 1 - - 0 - - -45 - - - 2 - :)>@] + decl:) }@] 0 - -42 - - - - 3 - 2 - [@(:include - 1 - - 0 - - -19 - - - 2 - decl:)@] - - - - - 0 - - -38 + -50 @@ -4005,7 +4121,29 @@ 0 - -34 + -51 + + + + 0 + + + + + 0 + + -12 + + + + 0 + + + + + 0 + + -40 @@ -4019,13 +4157,13 @@ decl - 52 + 54 reno_layer - 45 + 47 0 @@ -4080,7 +4218,7 @@ 3 2 - [@class (:link + [@typedef T (:link 1 0 @@ -4089,7 +4227,7 @@ 2 - :);@] + mod="m":);@] @@ -4107,38 +4245,29 @@ 0 - -12 + -10 - 5 + 3 2 - [@(:link + [@class (:link 1 0 - -25 + -10 2 - :) (:link - 1 - - 0 - - -12 - - - 2 - :)();@] + :);@] 0 - -13 + -11 @@ -4156,6 +4285,17 @@ 0 + + + 0 + + -13 + + + + 0 + + 0 @@ -4164,9 +4304,9 @@ - 5 + 7 2 - [@template <class E, class Tag, class T> E const & (:link + [@(:link 1 0 @@ -4175,16 +4315,25 @@ 2 - mod="/":)( E const & x, (:link + mod="m":)(); (:link 1 0 - -19 + -15 2 - :)<Tag,T> const & v );@] + mod="m":)( (:link + 1 + + 0 + + -10 + + + 2 + :) const & x );@] @@ -4195,9 +4344,18 @@ - 3 + 5 2 - [@template <class T> ---unspecified--- (:link + [@(:link + 1 + + 0 + + -30 + + + 2 + :) (:link 1 0 @@ -4206,7 +4364,7 @@ 2 - :)( T const & e );@] + :)();@] @@ -4217,27 +4375,7 @@ - 5 - 2 - [@template <class T> (:link - 1 - - 0 - - -25 - - - 2 - :) (:link - 1 - - 0 - - -17 - - - 2 - :)( T const & e );@] + 0 @@ -4248,18 +4386,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 - - -18 - - - 2 - :)( E const & x );@] + 0 @@ -4270,9 +4397,9 @@ - 3 + 5 2 - [@template <class Tag,class T> class (:link + [@template <class E, class Tag, class T> E const & (:link 1 0 @@ -4281,7 +4408,16 @@ 2 - :);@] + mod="/":)( E const & x, (:link + 1 + + 0 + + -23 + + + 2 + :)<Tag,T> const & v );@] @@ -4292,18 +4428,9 @@ - 5 + 3 2 - [@(:link - 1 - - 0 - - -22 - - - 2 - mod="m":) const & (:link + [@template <class T> ---unspecified--- (:link 1 0 @@ -4312,7 +4439,7 @@ 2 - mod="m":)() const;@] + :)( T const & e );@] @@ -4323,7 +4450,27 @@ - 0 + 5 + 2 + [@template <class T> (:link + 1 + + 0 + + -30 + + + 2 + :) (:link + 1 + + 0 + + -21 + + + 2 + :)( T const & e );@] @@ -4336,7 +4483,7 @@ 3 2 - [@typedef T (:link + [@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 @@ -4345,7 +4492,7 @@ 2 - mod="m":);@] + :)( E const & x );@] @@ -4356,7 +4503,18 @@ - 0 + 3 + 2 + [@template <class Tag,class T> class (:link + 1 + + 0 + + -23 + + + 2 + :);@] @@ -4367,7 +4525,27 @@ - 0 + 5 + 2 + [@(:link + 1 + + 0 + + -8 + + + 2 + mod="m":) const & (:link + 1 + + 0 + + -24 + + + 2 + mod="m":)() const;@] @@ -4378,18 +4556,7 @@ - 3 - 2 - [@typedef ---unspecified--- (:link - 1 - - 0 - - -25 - - - 2 - :);@] + 0 @@ -4422,27 +4589,7 @@ - 5 - 2 - [@std::string (:link - 1 - - 0 - - -28 - - - 2 - :)( boost::(:link - 1 - - 0 - - -8 - - - 2 - :) const & );@] + 0 @@ -4464,9 +4611,9 @@ - 5 + 3 2 - [@#ifdef BOOST_NO_EXCEPTIONS void (:link + [@typedef ---unspecified--- (:link 1 0 @@ -4475,16 +4622,7 @@ 2 - :)( std::exception const & e ); // user defined #else template <class E> void (:link - 1 - - 0 - - -30 - - - 2 - :)( E const & e ); #endif@] + :);@] @@ -4495,27 +4633,7 @@ - 5 - 2 - [@(:link - 1 - - 0 - - -31 - - - 2 - mod="m":)( (:link - 1 - - 0 - - -22 - - - 2 - mod="m":) const & v );@] + 0 @@ -4526,36 +4644,7 @@ - 7 - 2 - [@template <class E, class Tag1, class T1, ..., class TagN, class TN> E const & (:link - 1 - - 0 - - -32 - - - 2 - mod="/":)( E const & x, (:link http://www.boost.org/libs/tuple/doc/tuple_users_guide.html|tuple:)< (:link - 1 - - 0 - - -19 - - - 2 - :)<Tag1,T1>, ..., (:link - 1 - - 0 - - -19 - - - 2 - :)<TagN,TN> > const & v );@] + 0 @@ -4565,10 +4654,72 @@ -33 + + 5 + 2 + [@std::string (:link + 1 + + 0 + + -33 + + + 2 + :)( boost::(:link + 1 + + 0 + + -10 + + + 2 + :) const & );@] + + + + + 0 + + -34 + + 0 + + + 0 + + -35 + + + + 5 + 2 + [@#ifdef BOOST_NO_EXCEPTIONS void (:link + 1 + + 0 + + -35 + + + 2 + :)( std::exception const & e ); // user defined #else template <class E> void (:link + 1 + + 0 + + -35 + + + 2 + :)( E const & e ); #endif@] + + 0 @@ -4593,7 +4744,7 @@ 0 - -8 + -10 2 @@ -4607,206 +4758,55 @@ -37 - - 19 - 2 - [@#if !defined( BOOST_NO_EXCEPTIONS ) && !defined( BOOST_EXCEPTION_DISABLE ) #include < - 1 - - 0 - - -26 - - - 2 - > #include <boost/current_function.hpp> #define - 1 - - 0 - - -37 - - - 2 - (x)\ ::boost:: - 1 - - 0 - - -30 - - - 2 - ( ::boost:: - 1 - - 0 - - -34 - - - 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 - 1 - - 0 - - -37 - - - 2 - (x) ::boost:: - 1 - - 0 - - -30 - - - 2 - (x) #endif@] - - - - - 0 - - -11 - - - - 0 - - - - - 0 - - -45 - - - - 0 - - - - - 0 - - -43 - - - - 0 - - - - - 0 - - -47 - - - - 0 - - - - - 0 - - -46 - - - - 0 - - - - - 0 - - -48 - - - - 0 - - - - - 0 - - -41 - - - - 0 - - - - - 0 - - -40 - - - - 0 - - - - - 0 - - -49 - - 7 2 + [@template <class E, class Tag1, class T1, ..., class TagN, class TN> E const & (:link + 1 + + 0 + + -37 + + + 2 + mod="/":)( E const & x, (:link http://www.boost.org/libs/tuple/doc/tuple_users_guide.html|tuple:)< (:link + 1 + + 0 + + -23 + + + 2 + :)<Tag1,T1>, ..., (:link + 1 + + 0 + + -23 + + + 2 + :)<TagN,TN> > const & v );@] + + + + + 0 + + -38 + + + + 5 + 2 [@(:link 1 0 - -49 - - - 2 - mod="m":)(); (:link - 1 - - 0 - - -49 + -38 2 @@ -4819,45 +4819,14 @@ 2 - :) const & x );@] + mod="m":) const & v );@] 0 - -35 - - - - 5 - 2 - [@void (:link - 1 - - 0 - - -35 - - - 2 - :)( (:link - 1 - - 0 - - -25 - - - 2 - :) const & ep ); - - - - - 0 - - -10 + -39 @@ -4879,40 +4848,101 @@ 0 - -39 + -43 - 0 + 19 + 2 + [@#if !defined( BOOST_NO_EXCEPTIONS ) && !defined( BOOST_EXCEPTION_DISABLE ) #include < + 1 + + 0 + + -31 + + + 2 + > #include <boost/current_function.hpp> #define + 1 + + 0 + + -43 + + + 2 + (x)\ ::boost:: + 1 + + 0 + + -35 + + + 2 + ( ::boost:: + 1 + + 0 + + -41 + + + 2 + (x) <<\ ::boost::(:link + 1 + + 0 + + -31 + + + 2 + |throw_function:)(BOOST_CURRENT_FUNCTION) <<\ ::boost::(:link + 1 + + 0 + + -31 + + + 2 + |throw_file:)(__FILE__) <<\ ::boost::(:link + 1 + + 0 + + -31 + + + 2 + |throw_line:)((int)__LINE__) ) #else #define + 1 + + 0 + + -43 + + + 2 + (x) ::boost:: + 1 + + 0 + + -35 + + + 2 + (x) #endif@] 0 - -42 - - - - 0 - - - - - 0 - - -38 - - - - 0 - - - - - 0 - - -34 + -41 @@ -4923,13 +4953,143 @@ 0 - -34 + -41 2 :)( T const & x );@] + + + 0 + + -42 + + + + 5 + 2 + [@void (:link + 1 + + 0 + + -42 + + + 2 + :)( (:link + 1 + + 0 + + -30 + + + 2 + :) const & ep ); + + + + + 0 + + -45 + + + + 0 + + + + + 0 + + -46 + + + + 0 + + + + + 0 + + -47 + + + + 0 + + + + + 0 + + -48 + + + + 0 + + + + + 0 + + -49 + + + + 0 + + + + + 0 + + -50 + + + + 0 + + + + + 0 + + -51 + + + + 0 + + + + + 0 + + -12 + + + + 0 + + + + + 0 + + -40 + + + + 0 + + @@ -4937,13 +5097,13 @@ include - 53 + 55 reno_layer - 45 + 47 0 @@ -4972,7 +5132,7 @@ 0 - -8 + -10 2 @@ -4994,7 +5154,7 @@ 0 - -28 + -33 2 @@ -5003,7 +5163,7 @@ 0 - -8 + -10 2 @@ -5012,7 +5172,7 @@ 0 - -8 + -10 2 @@ -5021,7 +5181,7 @@ 0 - -15 + -19 2 @@ -5030,7 +5190,7 @@ 0 - -39 + -45 2 @@ -5039,7 +5199,7 @@ 0 - -8 + -10 2 @@ -5048,7 +5208,7 @@ 0 - -8 + -10 2 @@ -5057,7 +5217,7 @@ 0 - -28 + -33 2 @@ -5066,7 +5226,7 @@ 0 - -14 + -18 2 @@ -5081,9 +5241,18 @@ - 13 + 5 2 - (:auto !!!:) (:include synopsis:) Class boost::(:link + (:auto !!!:) (:include synopsis:) !!!!Definition: The expression + 1 + + 0 + + -23 + + + 2 + <Tag,T>::(:link 1 0 @@ -5092,52 +5261,7 @@ 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 - - -8 - - - 2 - :) can store data of arbitrary types, using the (:link - 1 - - 0 - - -19 - - - 2 - :) wrapper and (:link - 1 - - 0 - - -15 - - - 2 - mod="/":). To retrieve data from a boost::(:link - 1 - - 0 - - -8 - - - 2 - :) object, use the (:link - 1 - - 0 - - -18 - - - 2 - :) function template. + mod="m":) evaluates to T. @@ -5148,151 +5272,441 @@ - 31 + 1 2 - (:auto !!!:) Traditionally, when using exceptions to report failures, the throw site: *creates an exception object of appropriate type, and *stuffs it with data relevant to the detected error. A higher context 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 to handle the failure at the catch site. 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 a 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 way *Simply derive your exception types from boos:: - 1 - - 0 - - -8 - - - 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. 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:: - 1 - - 0 - - -8 - - - 2 - { }; struct file_read_error: virtual exception_base { }; typedef boost:: - 1 - - 0 - - -19 - - - 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: [@typedef boost:: - 1 - - 0 - - -19 - - - 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:: - 1 - - 0 - - -8 - - - 2 - do_something(); .... } else throw file_open_error() (:link - 1 - - 0 - - -15 - - - 2 - |<<:) errno_code(errno); } catch( boost:: - 1 - - 0 - - -8 - - - 2 - & e ) { e (:link - 1 - - 0 - - -15 - - - 2 - |<<:) file_name(“foo.txt”); throw; }@] And here is how the handler retreives data from exceptions that derive from boost:: - 1 - - 0 - - -8 - - - 2 - : [@catch( io_error & e ) { std::cerr << “I/O Error!\n”; if( shared_ptr<std::string const> fn= - 1 - - 0 - - -18 - - - 2 - <file_name>(e) ) std::cerr << “File name: “ << *fn << “\n”; if( shared_ptr<int const> c= - 1 - - 0 - - -18 - - - 2 - <errno_code>(e) ) std::cerr << “OS says: “ << strerror(*c) << “\n”; }@] !!!Exception types as simple semantic tags Deriving from boost:: - 1 - - 0 - - -8 - - - 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:: - 1 - - 0 - - -8 - - - 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:: - 1 - - 0 - - -8 - - - 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 { };@] + (:auto !!!:) !!!Synopsis (:include synopsis:) 0 - -12 + -10 + + + + 13 + 2 + (:auto !!!:) (:include synopsis:) Class boost::(:link + 1 + + 0 + + -10 + + + 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 + + -10 + + + 2 + :) can store data of arbitrary types, using the (:link + 1 + + 0 + + -23 + + + 2 + :) wrapper and (:link + 1 + + 0 + + -19 + + + 2 + mod="/":). To retrieve data from a boost::(:link + 1 + + 0 + + -10 + + + 2 + :) object, use the (:link + 1 + + 0 + + -22 + + + 2 + :) function template. + + + + + 0 + + -11 + + + + 27 + 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 boos::(:link + 1 + + 0 + + -10 + + + 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 + + -10 + + + 2 + :) { }; struct file_read_error: virtual exception_base { }; typedef boost::(:link + 1 + + 0 + + -23 + + + 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 + + -10 + + + 2 + :): [@typedef boost::(:link + 1 + + 0 + + -23 + + + 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 + + -10 + + + 2 + :) do_something(); .... } else throw file_open_error() (:link + 1 + + 0 + + -19 + + + 2 + |<<:) errno_code(errno); } catch( boost::(:link + 1 + + 0 + + -10 + + + 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 + + -10 + + + 2 + :): [@catch( io_error & e ) { std::cerr << “I/O Error!\n”; if( shared_ptr<std::string const> fn=(:link + 1 + + 0 + + -22 + + + 2 + :)<file_name>(e) ) std::cerr << “File name: “ << *fn << “\n”; if( shared_ptr<int const> c=(:link + 1 + + 0 + + -22 + + + 2 + :)<errno_code>(e) ) std::cerr << “OS says: “ << strerror(*c) << “\n”; }@] + + + + + 0 + + -14 + + + + 11 + 2 + (:auto !!:) All exception types that derive from boost::(:link + 1 + + 0 + + -10 + + + 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 + + -10 + + + 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 + + -28 + + + 2 + :) (:include + 1 + + 0 + + -29 + + + 2 + :) (:include + 1 + + 0 + + -50 + + + 2 + :) + + + + + 0 + + -13 + + + + 27 + 2 + (:auto !!:) Some exception hierarchies can not be modified to make boost::(:link + 1 + + 0 + + -10 + + + 2 + :) a base type. In this case, the (:link + 1 + + 0 + + -41 + + + 2 + :) function template can be used to make exception objects derive from boost::(:link + 1 + + 0 + + -10 + + + 2 + :) anyway. Here is an example: [@#include <(:link + 1 + + 0 + + -45 + + + 2 + :)> #include <stdexcept> typedef boost::(:link + 1 + + 0 + + -23 + + + 2 + :)<struct tag_std_range_min,size_t> std_range_min; typedef boost::(:link + 1 + + 0 + + -23 + + + 2 + :)<struct tag_std_range_max,size_t> std_range_max; typedef boost::(:link + 1 + + 0 + + -23 + + + 2 + :)<struct tag_std_range_index,size_t> std_range_index; template <class T> class my_container { public: size_t size() const; T const & operator[]( size_t i ) const { if( i > size() ) throw boost::(:link + 1 + + 0 + + -41 + + + 2 + :)(std::range_error("Index out of range")) << std_range_min(0) << std_range_max(size()) << std_range_index(i); //.... } }; @] The call to (:link + 1 + + 0 + + -41 + + + 2 + :)<T> gets us an object of ''unspecified type'' which is guaranteed to derive from both boost::(:link + 1 + + 0 + + -10 + + + 2 + :) and T. This makes it possible to use (:link + 1 + + 0 + + -19 + + + 2 + mod="/":) to store additional information in the exception object. The exception can be intercepted as T &, so existing exception handling will not break. It can also be intercepted as boost::(:link + 1 + + 0 + + -10 + + + 2 + :) &, so that (:link + 1 + + 0 + + -14 + + + 2 + |more information can be added to the exception at a later time:). + + + + + 0 + + -15 + + + + 7 + 2 + (:auto !!!:) (:include decl:) !!!!Effects: * Default constructor: initializes an empty boost::(:link + 1 + + 0 + + -10 + + + 2 + :) object. * Copy constructor: initializes a boost::(:link + 1 + + 0 + + -10 + + + 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. + + + + + 0 + + -16 @@ -5303,7 +5717,7 @@ 0 - -12 + -16 2 @@ -5312,7 +5726,7 @@ 0 - -25 + -30 2 @@ -5321,7 +5735,7 @@ 0 - -25 + -30 2 @@ -5330,7 +5744,7 @@ 0 - -12 + -16 2 @@ -5339,7 +5753,7 @@ 0 - -12 + -16 2 @@ -5348,7 +5762,7 @@ 0 - -16 + -20 2 @@ -5357,7 +5771,7 @@ 0 - -16 + -20 2 @@ -5366,7 +5780,7 @@ 0 - -12 + -16 2 @@ -5375,7 +5789,7 @@ 0 - -25 + -30 2 @@ -5393,7 +5807,7 @@ 0 - -8 + -10 2 @@ -5402,7 +5816,7 @@ 0 - -8 + -10 2 @@ -5420,7 +5834,7 @@ 0 - -8 + -10 2 @@ -5431,7 +5845,7 @@ 0 - -13 + -17 @@ -5444,7 +5858,7 @@ 0 - -14 + -18 @@ -5455,7 +5869,7 @@ 0 - -28 + -33 2 @@ -5466,7 +5880,7 @@ 0 - -15 + -19 @@ -5477,7 +5891,7 @@ 0 - -8 + -10 2 @@ -5486,7 +5900,7 @@ 0 - -8 + -10 2 @@ -5495,7 +5909,7 @@ 0 - -19 + -23 2 @@ -5506,7 +5920,7 @@ 0 - -16 + -20 @@ -5517,7 +5931,7 @@ 0 - -25 + -30 2 @@ -5526,7 +5940,7 @@ 0 - -16 + -20 2 @@ -5535,7 +5949,7 @@ 0 - -16 + -20 2 @@ -5544,7 +5958,7 @@ 0 - -12 + -16 2 @@ -5553,7 +5967,7 @@ 0 - -25 + -30 2 @@ -5571,7 +5985,7 @@ 0 - -12 + -16 2 @@ -5580,7 +5994,7 @@ 0 - -30 + -35 2 @@ -5589,7 +6003,7 @@ 0 - -8 + -10 2 @@ -5598,7 +6012,7 @@ 0 - -25 + -30 2 @@ -5609,7 +6023,7 @@ 0 - -17 + -21 @@ -5620,7 +6034,7 @@ 0 - -16 + -20 2 @@ -5629,7 +6043,7 @@ 0 - -12 + -16 2 @@ -5640,7 +6054,7 @@ 0 - -18 + -22 @@ -5651,7 +6065,7 @@ 0 - -19 + -23 2 @@ -5660,7 +6074,7 @@ 0 - -18 + -22 2 @@ -5669,7 +6083,7 @@ 0 - -8 + -10 2 @@ -5678,7 +6092,7 @@ 0 - -15 + -19 2 @@ -5687,133 +6101,12 @@ 0 - -18 + -22 2 :) may be affected by the build (:link 1 - - 0 - - -38 - - - 2 - :). - - - - - 0 - - -19 - - - - 25 - 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 - 1 - - 0 - - -19 - - - 2 - :)<Tag,T> can be passed to (:link - 1 - - 0 - - -15 - - - 2 - mod="/":) to be stored in objects of type boost::(:link - 1 - - 0 - - -8 - - - 2 - :). !!!!Note: The header <(:link - 1 - - 0 - - -42 - - - 2 - :)> provides a declaration of the (:link - 1 - - 0 - - -19 - - - 2 - :) template, which is sufficient for the purpose of typedefing an instance for specific Tag and T, like this: [@#include <(:link - 1 - - 0 - - -42 - - - 2 - :)> typedef boost::(:link - 1 - - 0 - - -19 - - - 2 - :)<struct tag_errno,int> errno_info;@] Of course, to actually add an (:link - 1 - - 0 - - -19 - - - 2 - :) object to (:link - 1 - - 0 - - -8 - - - 2 - mod="p":) using (:link - 1 - - 0 - - -15 - - - 2 - mod="/":), or to retrieve it using (:link - 1 - - 0 - - -18 - - - 2 - :), you must first #include <(:link - 1 0 @@ -5821,129 +6114,9 @@ 2 - :)>. - - - - - 0 - - -20 - - - - 5 - 2 - (:auto !!!:) (:include synopsis:) !!!!Description: Returns a const reference to the copy of the value passed to (:link - 1 - - 0 - - -19 - - - 2 - :)'s constructor stored in the (:link - 1 - - 0 - - -19 - - - 2 - :) object. !!!!Throws: Nothing. - - - - - 0 - - -21 - - - - 11 - 2 - (:auto !!!:) Here is how cloning can be enabled in a throw-expression (15.1): [@#include <(:link - 1 - - 0 - - -44 - - - 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 - - -8 - - - 2 - :) { }; void file_read( FILE * f, void * buffer, size_t size ) { if( size!=fread(buffer,1,size,f) ) throw boost::(:link - 1 - - 0 - - -16 - - - 2 - :)(file_read_error()) << errno_info(errno); }@] Of course, (:link - 1 - - 0 - - -16 - - - 2 - :) may be used with any exception type; there is no requirement that it should derive from boost::(:link - 1 - - 0 - - -8 - - - 2 :). - - - 0 - - -22 - - - - 5 - 2 - (:auto !!!:) (:include synopsis:) !!!!Definition: The expression - 1 - - 0 - - -19 - - - 2 - <Tag,T>::(:link - 1 - - 0 - - -22 - - - 2 - mod="m":) evaluates to T. - - 0 @@ -5952,18 +6125,18 @@ - 17 + 25 2 - (:auto !!!:) The following example demonstrates how errno can be stored in exception objects using Boost Exception: [@#include <(: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 - -39 + -23 2 - :)> #include <errno.h> #include <iostream> typedef boost::(:link + :)<Tag,T> can be passed to (:link 1 0 @@ -5972,16 +6145,70 @@ 2 - :)<struct tag_errno,int> errno_info; //(1) class my_error: public boost::(:link + mod="/":) to be stored in objects of type boost::(:link 1 0 - -8 + -10 2 - :), public std::exception { }; //(2) void f() { throw my_error() << errno_info(errno); //(3) } @] First, we instantiate the (:link + :). !!!!Note: The header <(:link + 1 + + 0 + + -26 + + + 2 + :)> provides a declaration of the (:link + 1 + + 0 + + -23 + + + 2 + :) template, which is sufficient for the purpose of typedefing an instance for specific Tag and T, like this: [@#include <(:link + 1 + + 0 + + -26 + + + 2 + :)> typedef boost::(:link + 1 + + 0 + + -23 + + + 2 + :)<struct tag_errno,int> errno_info;@] Of course, to actually add an (:link + 1 + + 0 + + -23 + + + 2 + :) object to (:link + 1 + + 0 + + -10 + + + 2 + mod="p":) using (:link 1 0 @@ -5990,43 +6217,25 @@ 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 + mod="/":), or to retrieve it using (:link 1 0 - -8 + -22 2 - :). Finally, (3) illustrates how the typedef from (1) can be used with (:link + :), you must first #include <(:link 1 0 - -15 + -47 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 - - -18 - - - 2 - :)<errno_info>(x) ) std::cerr << "Error code: " << *err; } }@] The (:link - 1 - - 0 - - -18 - - - 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. + :)>. @@ -6037,90 +6246,27 @@ - 19 + 5 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:: + (:auto !!!:) (:include synopsis:) !!!!Description: Returns a const reference to the copy of the value passed to (:link 1 0 - -8 + -23 2 - allows us to free the file_read function from the burden of storing the file name in exceptions it throws: [@#include <(:link + :)'s constructor stored in the (:link 1 0 - -39 + -23 2 - :)> #include <stdio.h> #include <errno.h> typedef boost::(:link - 1 - - 0 - - -19 - - - 2 - :)<struct tag_errno,int> errno_info; class file_read_error: public boost::(:link - 1 - - 0 - - -8 - - - 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 - - -39 - - - 2 - :)> #include <boost/shared_ptr.hpp> #include <stdio.h> #include <string> typedef boost::(:link - 1 - - 0 - - -19 - - - 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 - - -8 - - - 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 - - -8 - - - 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 - - -8 - - - 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''. + :) object. !!!!Throws: Nothing. @@ -6131,81 +6277,9 @@ - 17 + 1 2 - (:auto !!!:) (:include synopsis:) The (:link - 1 - - 0 - - -25 - - - 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 - - -25 - - - 2 - :)'s operations do not throw. Two instances of (:link - 1 - - 0 - - -25 - - - 2 - :) are equivalent and compare equal if and only if they refer to the same exception. The default constructor of (:link - 1 - - 0 - - -25 - - - 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 - - -25 - - - 2 - :) references to the same exception object. * It is illegal for multiple threads to modify the same (:link - 1 - - 0 - - -25 - - - 2 - :) object concurrently. * While calling (:link - 1 - - 0 - - -12 - - - 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 - - -35 - - - 2 - :) concurrently to throw the same exception object into multiple threads. + (:auto !!:) !!!Synopsis (:include synopsis:) @@ -6229,7 +6303,54 @@ - 0 + 11 + 2 + (:auto !!!:) Here is how cloning can be enabled in a throw-expression (15.1): [@#include <(:link + 1 + + 0 + + -47 + + + 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 + + -10 + + + 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 + + -10 + + + 2 + :). @@ -6240,9 +6361,54 @@ - 23 + 17 2 - (:auto !!!:) (:include synopsis:) !!!!Returns: This function returns a string value that is automatically composed from the string representations of all (:link + (:auto !!!:) The following example demonstrates how errno can be stored in exception objects using Boost Exception: [@#include <(:link + 1 + + 0 + + -45 + + + 2 + :)> #include <errno.h> #include <iostream> typedef boost::(:link + 1 + + 0 + + -23 + + + 2 + :)<struct tag_errno,int> errno_info; //(1) class my_error: public boost::(:link + 1 + + 0 + + -10 + + + 2 + :), public std::exception { }; //(2) void f() { throw my_error() << errno_info(errno); //(3) } @] First, we instantiate the (:link + 1 + + 0 + + -23 + + + 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 + + -10 + + + 2 + :). Finally, (3) illustrates how the typedef from (1) can be used with (:link 1 0 @@ -6251,97 +6417,25 @@ 2 - :) objects stored in a boost::(:link + |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 - -8 + -22 2 - :) through (:link + :)<errno_info>(x) ) std::cerr << "Error code: " << *err; } }@] The (:link 1 0 - -15 + -22 2 - mod="/":), along with other diagnostic information relevant to the exception. The string representation of each (:link - 1 - - 0 - - -19 - - - 2 - :) object is deduced by a function call that is bound at the time the (:link - 1 - - 0 - - -19 - - - 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 - - -19 - - - 2 - :)<Tag,T> (the return value is expected to be of type std::string.) #Unqualified call to to_string(x.(:link - 1 - - 0 - - -20 - - - 2 - mod="m":)()) (the return value is expected to be of type std::string.) #Unqualified call to s << x.(:link - 1 - - 0 - - -20 - - - 2 - mod="m":)(), where s is a std::ostringstream. The first successfully bound function is used at the time (:link - 1 - - 0 - - -28 - - - 2 - :) is called; if all 3 overload resolutions are unsuccessful, the system is unable to convert the (:link - 1 - - 0 - - -19 - - - 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 - 1 - - 0 - - -14 - - - 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. @@ -6352,54 +6446,90 @@ - 11 + 19 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 + (: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 - -16 + -10 2 - :) at the time of the throw is required in order to use cloning. !!!!Note: All exceptions emitted by the familiar function boost::(:link + allows us to free the file_read function from the burden of storing the file name in exceptions it throws: [@#include <(:link 1 0 - -30 + -45 2 - :) are guaranteed to derive from boost::(:link + :)> #include <stdio.h> #include <errno.h> typedef boost::(:link 1 0 - -8 + -23 2 - :) and to support cloning. (:include + :)<struct tag_errno,int> errno_info; class file_read_error: public boost::(:link 1 0 - -21 + -10 2 - :) (:include + :) { }; 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 - -48 + -45 2 - :) + :)> #include <boost/shared_ptr.hpp> #include <stdio.h> #include <string> typedef boost::(:link + 1 + + 0 + + -23 + + + 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 + + -10 + + + 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 + + -10 + + + 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 + + -10 + + + 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''. @@ -6410,9 +6540,9 @@ - 13 + 17 2 - (:auto !!!:) (:include synopsis:) !!!!Requirements: E must derive publicly from std::exception. !!!!Effects: * If BOOST_NO_EXCEPTIONS is not defined, boost::(:link + (:auto !!!:) (:include synopsis:) The (:link 1 0 @@ -6421,7 +6551,52 @@ 2 - :)(e) is equivalent to throw boost::(:link + :) 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 + + -30 + + + 2 + :)'s operations do not throw. Two instances of (:link + 1 + + 0 + + -30 + + + 2 + :) are equivalent and compare equal if and only if they refer to the same exception. The default constructor of (:link + 1 + + 0 + + -30 + + + 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 + + -30 + + + 2 + :) references to the same exception object. * It is illegal for multiple threads to modify the same (:link + 1 + + 0 + + -30 + + + 2 + :) object concurrently. * While calling (:link 1 0 @@ -6430,43 +6605,16 @@ 2 - :)(boost::(:link + :) 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 - -34 + -42 2 - :)(e)), unless BOOST_EXCEPTION_DISABLE is defined, in which case boost::(:link - 1 - - 0 - - -30 - - - 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 - - -30 - - - 2 - :) are allowed to assume that the function never returns; therefore, if the user-defined (:link - 1 - - 0 - - -30 - - - 2 - :) returns, the behavior is undefined. + :) concurrently to throw the same exception object into multiple threads. @@ -6477,18 +6625,9 @@ - 3 + 1 2 - (:auto !!!:) (:include synopsis:) !!!!Effects: Stores a copy of v in the - 1 - - 0 - - -19 - - - 2 - object. (:include throws:) + (:auto !!:) !!!Synopsis (:include synopsis:) @@ -6499,27 +6638,7 @@ - 5 - 2 - (:auto !!!:) (:include synopsis:) !!!!Requirements: E must be boost::(:link - 1 - - 0 - - -8 - - - 2 - :), or a type that derives (indirectly) from boost::(:link - 1 - - 0 - - -8 - - - 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 @@ -6530,7 +6649,233 @@ - 0 + 23 + 2 + (:auto !!!:) (:include synopsis:) !!!!Returns: This function returns a string value that is automatically composed from the string representations of all (:link + 1 + + 0 + + -23 + + + 2 + :) objects stored in a boost::(:link + 1 + + 0 + + -10 + + + 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 + + -23 + + + 2 + :) object is deduced by a function call that is bound at the time the (:link + 1 + + 0 + + -23 + + + 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 + + -23 + + + 2 + :)<Tag,T> (the return value is expected to be of type std::string.) #Unqualified call to to_string(x.(:link + 1 + + 0 + + -24 + + + 2 + mod="m":)()) (the return value is expected to be of type std::string.) #Unqualified call to s << x.(:link + 1 + + 0 + + -24 + + + 2 + mod="m":)(), where s is a std::ostringstream. The first successfully bound function is used at the time (:link + 1 + + 0 + + -33 + + + 2 + :) is called; if all 3 overload resolutions are unsuccessful, the system is unable to convert the (:link + 1 + + 0 + + -23 + + + 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 + 1 + + 0 + + -18 + + + 2 + :) + + + + + 0 + + -34 + + + + 11 + 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 + + -35 + + + 2 + :) are guaranteed to derive from boost::(:link + 1 + + 0 + + -10 + + + 2 + :) and to support cloning. (:include + 1 + + 0 + + -27 + + + 2 + :) (:include + 1 + + 0 + + -51 + + + 2 + :) + + + + + 0 + + -35 + + + + 13 + 2 + (:auto !!!:) (:include synopsis:) !!!!Requirements: E must derive publicly from std::exception. !!!!Effects: * If BOOST_NO_EXCEPTIONS is not defined, boost::(:link + 1 + + 0 + + -35 + + + 2 + :)(e) is equivalent to throw boost::(:link + 1 + + 0 + + -20 + + + 2 + :)(boost::(:link + 1 + + 0 + + -41 + + + 2 + :)(e)), unless BOOST_EXCEPTION_DISABLE is defined, in which case boost::(:link + 1 + + 0 + + -35 + + + 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 + + -35 + + + 2 + :) are allowed to assume that the function never returns; therefore, if the user-defined (:link + 1 + + 0 + + -35 + + + 2 + :) returns, the behavior is undefined. @@ -6548,7 +6893,7 @@ 0 - -25 + -30 2 @@ -6557,7 +6902,7 @@ 0 - -12 + -16 2 @@ -6571,6 +6916,146 @@ -37 + + 5 + 2 + (:auto !!!:) (:include synopsis:) !!!!Requirements: E must be boost::(:link + 1 + + 0 + + -10 + + + 2 + :), or a type that derives (indirectly) from boost::(:link + 1 + + 0 + + -10 + + + 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 + + -38 + + + + 3 + 2 + (:auto !!!:) (:include synopsis:) !!!!Effects: Stores a copy of v in the + 1 + + 0 + + -23 + + + 2 + object. (:include throws:) + + + + + 0 + + -39 + + + + 0 + + + + + 0 + + -44 + + + + 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 + + -22 + + + 2 + :) function template can be called with any exception type. If BOOST_NO_RTTI is defined, (:link + 1 + + 0 + + -22 + + + 2 + :) can be used only with objects of type boost::(:link + 1 + + 0 + + -10 + + + 2 + :). '''BOOST_EXCEPTION_DISABLE''' By default, (:link + 1 + + 0 + + -20 + + + 2 + :) and (:link + 1 + + 0 + + -41 + + + 2 + :) are integrated directly in the (:link + 1 + + 0 + + -35 + + + 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 + + -49 + + + 2 + :). + + + + + 0 + + -43 + + 7 2 @@ -6579,7 +7064,7 @@ 0 - -30 + -35 2 @@ -6588,7 +7073,7 @@ 0 - -18 + -22 2 @@ -6597,7 +7082,7 @@ 0 - -28 + -33 2 @@ -6608,121 +7093,13 @@ 0 - -11 + -41 - 27 + 5 2 - (:auto !!:) Some exception hierarchies can not be modified to make boost::(:link - 1 - - 0 - - -8 - - - 2 - :) a base type. In this case, the (:link - 1 - - 0 - - -34 - - - 2 - :) function template can be used to make exception objects derive from boost::(:link - 1 - - 0 - - -8 - - - 2 - :) anyway. Here is an example: [@#include <(:link - 1 - - 0 - - -39 - - - 2 - :)> #include <stdexcept> typedef boost::(:link - 1 - - 0 - - -19 - - - 2 - :)<struct tag_std_range_min,size_t> std_range_min; typedef boost::(:link - 1 - - 0 - - -19 - - - 2 - :)<struct tag_std_range_max,size_t> std_range_max; typedef boost::(:link - 1 - - 0 - - -19 - - - 2 - :)<struct tag_std_range_index,size_t> std_range_index; template <class T> class my_container { public: size_t size() const; T const & operator[]( size_t i ) const { if( i > size() ) throw boost::(:link - 1 - - 0 - - -34 - - - 2 - :)(std::range_error("Index out of range")) << std_range_min(0) << std_range_max(size()) << std_range_index(i); //.... } }; @] The call to (:link - 1 - - 0 - - -34 - - - 2 - :)<T> gets us an object of ''unspecified type'' which is guaranteed to derive from both boost::(:link - 1 - - 0 - - -8 - - - 2 - :) and T. This makes it possible to use (:link - 1 - - 0 - - -15 - - - 2 - mod="/":) to store additional information in the exception object. The exception can be intercepted as T &, so existing exception handling will not break. It can also be intercepted as boost::(:link - 1 - - 0 - - -8 - - - 2 - :) &, so that (:link + (: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 @@ -6731,7 +7108,29 @@ 2 - |more information can be added to the exception at a later time:). + :), 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 + + -10 + + + 2 + :). The T sub-object is initialized from x by the T copy constructor. !!!!Throws: Nothing. + + + + + 0 + + -42 + + + + 1 + 2 + (:auto !!!:) (:include synopsis:) !!!!Precondition: ep shall not be null. !!!!Throws: The exception to which ep refers. @@ -6751,7 +7150,7 @@ 0 - -43 + -46 @@ -6767,6 +7166,45 @@ -47 + + 1 + 2 + (:auto !!:) !!!Synopsis (:include synopsis:) + + + + + 0 + + -48 + + + + 1 + 2 + (:auto !!:) !!!Synopsis (:include synopsis:) + + + + + 0 + + -49 + + + + 1 + 2 + (:auto !!:) !!!Synopsis (:include synopsis:) + + + + + 0 + + -50 + + 13 2 @@ -6784,7 +7222,7 @@ 0 - -19 + -23 2 @@ -6793,7 +7231,7 @@ 0 - -19 + -23 2 @@ -6802,7 +7240,7 @@ 0 - -19 + -23 2 @@ -6811,7 +7249,7 @@ 0 - -8 + -10 2 @@ -6820,7 +7258,7 @@ 0 - -18 + -22 2 @@ -6831,20 +7269,7 @@ 0 - -46 - - - - 1 - 2 - (:auto !!:) !!!Synopsis (:include synopsis:) - - - - - 0 - - -48 + -51 @@ -6855,7 +7280,7 @@ 0 - -12 + -16 2 @@ -6864,7 +7289,7 @@ 0 - -25 + -30 2 @@ -6873,7 +7298,7 @@ 0 - -45 + -48 2 @@ -6882,7 +7307,7 @@ 0 - -8 + -10 2 @@ -6891,7 +7316,7 @@ 0 - -25 + -30 2 @@ -6900,7 +7325,7 @@ 0 - -25 + -30 2 @@ -6909,7 +7334,7 @@ 0 - -12 + -16 2 @@ -6918,7 +7343,7 @@ 0 - -12 + -16 2 @@ -6927,7 +7352,7 @@ 0 - -35 + -42 2 @@ -6936,7 +7361,7 @@ 0 - -25 + -30 2 @@ -6945,7 +7370,7 @@ 0 - -35 + -42 2 @@ -6954,7 +7379,7 @@ 0 - -12 + -16 2 @@ -6963,7 +7388,7 @@ 0 - -25 + -30 2 @@ -6972,7 +7397,7 @@ 0 - -16 + -20 2 @@ -6981,7 +7406,7 @@ 0 - -25 + -30 2 @@ -6999,7 +7424,7 @@ 0 - -12 + -16 2 @@ -7008,7 +7433,7 @@ 0 - -35 + -42 2 @@ -7019,13 +7444,40 @@ 0 - -41 + -12 - 1 + 7 2 - (:auto !!!:) !!!Synopsis (:include synopsis:) + (:auto !!!:) Deriving from boost::(:link + 1 + + 0 + + -10 + + + 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 + + -10 + + + 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 + + -10 + + + 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. @@ -7035,267 +7487,28 @@ -40 - - 1 - 2 - (:auto !!:) !!!Synopsis (:include synopsis:) - - - - - 0 - - -49 - - - - 7 - 2 - (:auto !!!:) (:include decl:) !!!!Effects: * Default constructor: initializes an empty boost::(:link - 1 - - 0 - - -8 - - - 2 - :) object. * Copy constructor: initializes a boost::(:link - 1 - - 0 - - -8 - - - 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. - - - - - 0 - - -35 - - - - 1 - 2 - (:auto !!!:) (:include synopsis:) !!!!Precondition: ep shall not be null. !!!!Throws: The exception to which ep refers. - - - - - 0 - - -10 - - - - 11 - 2 - (:auto !!:) All exception types that derive from boost::(:link - 1 - - 0 - - -8 - - - 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. Data can be added to a boost::(:link - 1 - - 0 - - -8 - - - 2 - :) at the time of the throw, or at a later time. (:include - 1 - - 0 - - -23 - - - 2 - :) (:include - 1 - - 0 - - -24 - - - 2 - :) (:include - 1 - - 0 - - -47 - - - 2 - :) - - - - - 0 - - -44 - - - - 1 - 2 - (:auto !!:) !!!Synopsis (:include synopsis:) - - - - - 0 - - -39 - - - - 1 - 2 - (:auto !!:) !!!Synopsis (:include synopsis:) - - - - - 0 - - -42 - - - - 1 - 2 - (:auto !!:) !!!Synopsis (:include synopsis:) - - - - - 0 - - -38 - - - - 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 - - -18 - - - 2 - :) function template can be called with any exception type. If BOOST_NO_RTTI is defined, (:link - 1 - - 0 - - -18 - - - 2 - :) can be used only with objects of type boost::(:link - 1 - - 0 - - -8 - - - 2 - :). '''BOOST_EXCEPTION_DISABLE''' By default, (:link - 1 - - 0 - - -16 - - - 2 - :) and (:link - 1 - - 0 - - -34 - - - 2 - :) are integrated directly in the (:link - 1 - - 0 - - -30 - - - 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 - - -46 - - - 2 - :). - - - - - 0 - - -34 - - 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 + (: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 - -8 + -10 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 + :) is used, because it enables exception types to be trivial structs with no members (there's nothing to initialize.) See (:link 1 0 - -8 + -12 2 - :). The T sub-object is initialized from x by the T copy constructor. !!!!Throws: Nothing. + mod="w":). @@ -7305,13 +7518,13 @@ throws - 54 + 56 reno_layer - 45 + 47 0 @@ -7371,7 +7584,7 @@ 0 - -12 + -10 @@ -7382,7 +7595,7 @@ 0 - -13 + -11 @@ -7400,6 +7613,17 @@ 0 + + + 0 + + -13 + + + + 0 + + 0 @@ -7408,9 +7632,7 @@ - 1 - 2 - !!!!Throws: std::bad_alloc, or any exception emitted by the T copy constructor. + 0 @@ -7454,7 +7676,9 @@ - 0 + 1 + 2 + !!!!Throws: std::bad_alloc, or any exception emitted by the T copy constructor. @@ -7586,9 +7810,7 @@ - 1 - 2 - !!!!Throws: Any exception emitted by v's copy constructor. + 0 @@ -7599,9 +7821,7 @@ - 1 - 2 - !!!!Throws: std::bad_alloc, or any exception emitted by T1..TN copy constructor. + 0 @@ -7615,6 +7835,28 @@ 0 + + + 0 + + -34 + + + + 0 + + + + + 0 + + -35 + + + + 0 + + 0 @@ -7634,124 +7876,29 @@ - 0 + 1 + 2 + !!!!Throws: std::bad_alloc, or any exception emitted by T1..TN copy constructor. 0 - -11 + -38 - 0 + 1 + 2 + !!!!Throws: Any exception emitted by v's copy constructor. 0 - -45 - - - - 0 - - - - - 0 - - -43 - - - - 0 - - - - - 0 - - -47 - - - - 0 - - - - - 0 - - -46 - - - - 0 - - - - - 0 - - -48 - - - - 0 - - - - - 0 - - -41 - - - - 0 - - - - - 0 - - -40 - - - - 0 - - - - - 0 - - -49 - - - - 0 - - - - - 0 - - -35 - - - - 0 - - - - - 0 - - -10 + -39 @@ -7773,7 +7920,18 @@ 0 - -39 + -43 + + + + 0 + + + + + 0 + + -41 @@ -7795,7 +7953,7 @@ 0 - -38 + -45 @@ -7806,7 +7964,84 @@ 0 - -34 + -46 + + + + 0 + + + + + 0 + + -47 + + + + 0 + + + + + 0 + + -48 + + + + 0 + + + + + 0 + + -49 + + + + 0 + + + + + 0 + + -50 + + + + 0 + + + + + 0 + + -51 + + + + 0 + + + + + 0 + + -12 + + + + 0 + + + + + 0 + + -40 @@ -7820,13 +8055,13 @@ synopsis - 55 + 57 reno_layer - 45 + 47 0 @@ -7877,11 +8112,11 @@ 0 - -26 + -47 2 - :)> [@namespace boost { (:include def pre_indent="4":) }@] + :)> [@(:include decl:)@] @@ -7892,14 +8127,25 @@ - 0 + 3 + 2 + [@#include < + 1 + + 0 + + -31 + + + 2 + > namespace boost { (:include api pre_indent="4":) }@] 0 - -12 + -10 @@ -7910,33 +8156,22 @@ 0 - -45 + -31 2 - :)> [@namespace boost { (:include decl pre_indent="4":) }@] + :)> [@namespace boost { (:include def pre_indent="4":) }@] 0 - -13 + -11 - 3 - 2 - [@#include < - 1 - - 0 - - -26 - - - 2 - > namespace boost { (:include api pre_indent="4":) }@] + 0 @@ -7950,6 +8185,17 @@ 0 + + + 0 + + -13 + + + + 0 + + 0 @@ -7958,18 +8204,7 @@ - 3 - 2 - `#include <(:link - 1 - - 0 - - -44 - - - 2 - :)>\\ [@namespace boost { (:include decl pre_indent="4":) }@] + 0 @@ -7982,16 +8217,16 @@ 3 2 - `#include < + `#include <(:link 1 0 - -41 + -48 2 - > [@namespace boost { (:include decl pre_indent="4":) }@] + :)> [@namespace boost { (:include decl pre_indent="4":) }@] @@ -8004,16 +8239,16 @@ 3 2 - `#include <(:link + [@#include < 1 0 - -45 + -31 2 - :)> [@namespace boost { (:include decl pre_indent="4":) }@] + > namespace boost { (:include api pre_indent="4":) }@] @@ -8024,18 +8259,7 @@ - 3 - 2 - `#include < - 1 - - 0 - - -43 - - - 2 - > [@namespace boost { (:include decl pre_indent="4":) }@] + 0 @@ -8053,11 +8277,11 @@ 0 - -44 + -47 2 - :)> [@namespace boost { (:include def pre_indent="4":) }@] + :)>\\ [@namespace boost { (:include decl pre_indent="4":) }@] @@ -8070,16 +8294,16 @@ 3 2 - `#include <(:link + `#include < 1 0 - -44 + -9 2 - :)> [@(:include decl:)@] + > [@namespace boost { (:include decl pre_indent="4":) }@] @@ -8090,7 +8314,18 @@ - 0 + 3 + 2 + `#include <(:link + 1 + + 0 + + -48 + + + 2 + :)> [@namespace boost { (:include decl pre_indent="4":) }@] @@ -8103,16 +8338,16 @@ 3 2 - `#include <(:link + `#include < 1 0 - -44 + -25 2 - :)> [@(:include decl:)@] + > [@namespace boost { (:include decl pre_indent="4":) }@] @@ -8123,7 +8358,18 @@ - 0 + 3 + 2 + `#include <(:link + 1 + + 0 + + -47 + + + 2 + :)> [@namespace boost { (:include def pre_indent="4":) }@] @@ -8134,7 +8380,18 @@ - 0 + 3 + 2 + `#include <(:link + 1 + + 0 + + -47 + + + 2 + :)> [@(:include decl:)@] @@ -8145,18 +8402,9 @@ - 3 + 1 2 - `#include <(:link - 1 - - 0 - - -45 - - - 2 - :)> [@namespace boost { (:include decl pre_indent="4":) }@] + [@#include <boost/shared_ptr.hpp> namespace boost { (:include api pre_indent="4":) }@] @@ -8191,18 +8439,7 @@ - 3 - 2 - `#include <(:link - 1 - - 0 - - -40 - - - 2 - :)>\\ [@namespace boost { (:include decl pre_indent="4":) }@] + 0 @@ -8231,93 +8468,7 @@ 0 - -46 - - - 2 - :)> [@namespace boost { (:include decl:) }@] - - - - - 0 - - -31 - - - - 3 - 2 - `#include <(:link - 1 - - 0 - - -44 - - - 2 - :)> [@(:include decl:)@] - - - - - 0 - - -32 - - - - 5 - 2 - `#include <(:link - 1 - - 0 - - -5 - - - 2 - :)> [@namespace boost { (:include - 1 - - 0 - - -32 - - - 2 - decl pre_indent="4":) }@] - - - - - 0 - - -33 - - - - 0 - - - - - 0 - - -36 - - - - 3 - 2 - `#include <(:link - 1 - - 0 - - -45 + -48 2 @@ -8328,13 +8479,37 @@ 0 - -37 + -31 + + + + 1 + 2 + [@namespace boost { (:include api pre_indent="4":) }@] + + + + + 0 + + -32 + + + + 0 + + + + + 0 + + -33 3 2 - `#include < + `#include <(:link 1 0 @@ -8343,139 +8518,14 @@ 2 - > (:include decl:) + :)>\\ [@namespace boost { (:include decl pre_indent="4":) }@] 0 - -11 - - - - 0 - - - - - 0 - - -45 - - - - 3 - 2 - [@#include <(:link - 1 - - 0 - - -26 - - - 2 - :)> namespace boost { (:include api pre_indent="4":) }@] - - - - - 0 - - -43 - - - - 1 - 2 - [@#include <boost/shared_ptr.hpp> namespace boost { (:include api pre_indent="4":) }@] - - - - - 0 - - -47 - - - - 0 - - - - - 0 - - -46 - - - - 1 - 2 - (:include api:) - - - - - 0 - - -48 - - - - 0 - - - - - 0 - - -41 - - - - 3 - 2 - [@#include < - 1 - - 0 - - -26 - - - 2 - > namespace boost { (:include api pre_indent="4":) }@] - - - - - 0 - - -40 - - - - 3 - 2 - [@#include <string> namespace boost { (:include - 1 - - 0 - - -8 - - - 2 - decl pre_indent="4":) (:include api pre_indent="4":) }@] - - - - - 0 - - -49 + -34 @@ -8497,7 +8547,29 @@ 0 - -45 + -49 + + + 2 + :)> [@namespace boost { (:include decl:) }@] + + + + + 0 + + -36 + + + + 3 + 2 + `#include <(:link + 1 + + 0 + + -48 2 @@ -8508,7 +8580,60 @@ 0 - -10 + -37 + + + + 5 + 2 + `#include <(:link + 1 + + 0 + + -5 + + + 2 + :)> [@namespace boost { (:include + 1 + + 0 + + -37 + + + 2 + decl pre_indent="4":) }@] + + + + + 0 + + -38 + + + + 3 + 2 + `#include <(:link + 1 + + 0 + + -47 + + + 2 + :)> [@(:include decl:)@] + + + + + 0 + + -39 @@ -8523,25 +8648,80 @@ - 3 - 2 - [@#include <(:link - 1 - - 0 - - -26 - - - 2 - :)> #include <boost/current_function.hpp> #include <boost/shared_ptr.hpp> namespace boost { (:include api pre_indent="4":) }@] + 0 0 - -39 + -43 + + + + 3 + 2 + `#include < + 1 + + 0 + + -49 + + + 2 + > (:include decl:) + + + + + 0 + + -41 + + + + 3 + 2 + `#include < + 1 + + 0 + + -17 + + + 2 + > [@namespace boost { (:include decl pre_indent="4":) }@] + + + + + 0 + + -42 + + + + 3 + 2 + `#include <(:link + 1 + + 0 + + -48 + + + 2 + :)> [@namespace boost { (:include decl pre_indent="4":) }@] + + + + + 0 + + -45 @@ -8554,20 +8734,86 @@ 0 - -42 + -46 - 1 + 3 2 - [@namespace boost { (:include api pre_indent="4":) }@] + [@#include <string> namespace boost { (:include + 1 + + 0 + + -10 + + + 2 + decl pre_indent="4":) (:include api pre_indent="4":) }@] 0 - -38 + -47 + + + + 3 + 2 + [@#include <(:link + 1 + + 0 + + -31 + + + 2 + :)> #include <boost/current_function.hpp> #include <boost/shared_ptr.hpp> namespace boost { (:include api pre_indent="4":) }@] + + + + + 0 + + -48 + + + + 3 + 2 + [@#include <(:link + 1 + + 0 + + -31 + + + 2 + :)> namespace boost { (:include api pre_indent="4":) }@] + + + + + 0 + + -49 + + + + 1 + 2 + (:include api:) + + + + + 0 + + -50 @@ -8578,22 +8824,33 @@ 0 - -34 + -51 - 3 - 2 - `#include < - 1 - - 0 - - -13 - - - 2 - > [@namespace boost { (:include decl pre_indent="4":) }@] + 0 + + + + + 0 + + -12 + + + + 0 + + + + + 0 + + -40 + + + + 0 @@ -8606,14 +8863,14 @@ - 56 + 58 reno_context_map - 45 + 47 -5 @@ -8630,14 +8887,17 @@ -9 - -12 + -10 - -13 + -11 -14 + + -13 + -15 @@ -8695,6 +8955,12 @@ -33 + + -34 + + + -35 + -36 @@ -8702,58 +8968,55 @@ -37 - -11 - - - -45 - - - -43 - - - -47 - - - -46 - - - -48 - - - -41 - - - -40 - - - -49 - - - -35 - - - -10 - - - -44 + -38 -39 + + -44 + + + -43 + + + -41 + -42 - -38 + -45 - -34 + -46 + + + -47 + + + -48 + + + -49 + + + -50 + + + -51 + + + -12 + + + -40 - 45 + 47 @@ -8768,7 +9031,7 @@ - -33 + -39 @@ -8785,7 +9048,7 @@ - -29 + -34 @@ -8802,7 +9065,7 @@ - -10 + -14 @@ -8819,7 +9082,7 @@ - -27 + -32 @@ -8836,24 +9099,7 @@ - -13 - - - - - - - 0 - - - - - - 1 - - - - -41 + -17 @@ -8873,6 +9119,57 @@ -9 + + + + + 0 + + + + + + 1 + + + + -11 + + + + + + + 0 + + + + + + 1 + + + + -40 + + + + + + + 0 + + + + + + 1 + + + + -12 + + @@ -8898,7 +9195,7 @@ - -31 + -38 @@ -8926,7 +9223,7 @@ - -15 + -19 @@ -8937,7 +9234,7 @@ FBC69CDA5E19FA40270F3855A8B99B2F77572439353F9DC5D15386F3520BC616 1405483403 8882 - 451 + 323 @@ -8950,7 +9247,7 @@ - -45 + -48 @@ -8974,7 +9271,7 @@ - -48 + -51 @@ -8998,7 +9295,7 @@ - -43 + -25 @@ -9022,7 +9319,7 @@ - -11 + -13 @@ -9050,7 +9347,7 @@ - -18 + -22 @@ -9074,7 +9371,7 @@ - -37 + -43 @@ -9122,7 +9419,7 @@ - -39 + -45 @@ -9150,7 +9447,7 @@ - -30 + -35 @@ -9182,7 +9479,7 @@ - -38 + -44 @@ -9206,7 +9503,7 @@ - -14 + -18 @@ -9234,7 +9531,7 @@ - -19 + -23 @@ -9266,7 +9563,7 @@ - -22 + -8 @@ -9298,7 +9595,7 @@ - -20 + -24 @@ -9322,7 +9619,7 @@ - -26 + -31 @@ -9378,7 +9675,7 @@ - -16 + -20 @@ -9406,7 +9703,7 @@ - -34 + -41 @@ -9434,7 +9731,7 @@ - -8 + -10 @@ -9466,7 +9763,7 @@ - -49 + -15 @@ -9518,7 +9815,7 @@ - -28 + -33 @@ -9542,7 +9839,7 @@ - -46 + -49 @@ -9566,7 +9863,7 @@ - -21 + -27 @@ -9590,7 +9887,7 @@ - -40 + -46 @@ -9614,7 +9911,7 @@ - -24 + -29 @@ -9625,7 +9922,7 @@ 808CABE6CCA47C52CC9DD21911BF0B42284A5DD55AC3E665B29ED2B5F16AF7DA 3660693492 8718 - 615 + 487 E23085202D084CBB50F289988A6A592F06D923B77D0AB25D7A98A7188DF5BE3B 1414247481 766 @@ -9642,7 +9939,7 @@ - -12 + -16 @@ -9653,7 +9950,7 @@ 808CABE6CCA47C52CC9DD21911BF0B42284A5DD55AC3E665B29ED2B5F16AF7DA 3660693492 8718 - 615 + 487 F86EB07D04CD0D0645080D1121DA899746D0C45137E17E1D9BE605E75396F047 1983537541 1346 @@ -9670,7 +9967,7 @@ - -25 + -30 @@ -9681,7 +9978,7 @@ 808CABE6CCA47C52CC9DD21911BF0B42284A5DD55AC3E665B29ED2B5F16AF7DA 3660693492 8718 - 615 + 487 DA033132CFA8F85C147C01F51FF7CF7399CF7D32D412F730EA3219CDAC608C72 3830952485 712 @@ -9709,7 +10006,7 @@ 808CABE6CCA47C52CC9DD21911BF0B42284A5DD55AC3E665B29ED2B5F16AF7DA 3660693492 8718 - 615 + 487 0E9DF8366080712A816BE91ABCEF1E2044145B63D75B0B995B537900F378189E 1069696031 255 @@ -9726,7 +10023,7 @@ - -35 + -42 @@ -9737,7 +10034,7 @@ 808CABE6CCA47C52CC9DD21911BF0B42284A5DD55AC3E665B29ED2B5F16AF7DA 3660693492 8718 - 615 + 487 0066D4E6E6B189906E6DE04F08509F3737511701A1B1355B37511EC18E8371F4 2078296250 305 @@ -9754,7 +10051,7 @@ - -17 + -21 @@ -9782,7 +10079,7 @@ - -42 + -26 @@ -9810,7 +10107,7 @@ - -32 + -37 @@ -9834,7 +10131,7 @@ - -23 + -28 @@ -9858,7 +10155,7 @@ - -47 + -50 @@ -9882,7 +10179,7 @@ - -44 + -47 @@ -9892,14 +10189,14 @@ - 57 + 59 tag_index - 43 + 44 1 @@ -9946,10 +10243,28 @@ 0 - -12 + -9 - exception_ptr free function + exception_ptr + + + + 0 + + -10 + + + type + + + + 0 + + -14 + + + tutorial @@ -9958,7 +10273,7 @@ -13 - error_info + tutorial @@ -9967,7 +10282,7 @@ -15 - error_info free function + function @@ -9985,16 +10300,7 @@ -17 - exception_ptr free function - - - - 0 - - -18 - - - error_info free function + error_info @@ -10003,7 +10309,7 @@ -19 - type + error_info free function @@ -10012,7 +10318,7 @@ -20 - function member + exception_ptr free function @@ -10021,7 +10327,7 @@ -21 - noalso noindex tutorial + exception_ptr free function @@ -10030,7 +10336,7 @@ -22 - type + error_info free function @@ -10039,7 +10345,7 @@ -23 - noalso noindex tutorial + type @@ -10048,7 +10354,7 @@ -24 - noalso noindex tutorial + function member @@ -10057,7 +10363,7 @@ -25 - type + error_info @@ -10075,7 +10381,7 @@ -27 - index noindex + noindex tutorial @@ -10084,7 +10390,7 @@ -28 - diagnostic_information free function + noalso noindex tutorial @@ -10093,7 +10399,7 @@ -29 - tutorial + noalso noindex tutorial @@ -10102,7 +10408,7 @@ -30 - free function + type @@ -10111,7 +10417,7 @@ -31 - function member + @@ -10120,7 +10426,7 @@ -32 - error_info free function + @@ -10129,7 +10435,25 @@ -33 - noindex + diagnostic_information free function + + + + 0 + + -34 + + + tutorial + + + + 0 + + -35 + + + free function @@ -10147,16 +10471,52 @@ -37 + error_info free function + + + + 0 + + -38 + + + function member + + + + 0 + + -39 + + + noindex + + + + 0 + + -43 + + 0 - -11 + -41 - tutorial + error_info free function + + + + 0 + + -42 + + + exception_ptr free function @@ -10171,10 +10531,10 @@ 0 - -43 + -46 - error_info + @@ -10183,15 +10543,6 @@ -47 - noalso noindex tutorial - - - - 0 - - -46 - - @@ -10201,24 +10552,6 @@ -48 - noalso noindex tutorial - - - - 0 - - -41 - - - exception_ptr - - - - 0 - - -40 - - @@ -10228,62 +10561,35 @@ -49 - function + 0 - -35 + -50 - exception_ptr free function + noalso noindex tutorial 0 - -10 + -51 + + + noindex tutorial + + + + 0 + + -40 tutorial - - - 0 - - -44 - - - - - - - 0 - - -39 - - - - - - - 0 - - -42 - - - - - - - 0 - - -34 - - - error_info free function - diff --git a/doc/tutorial_enable_error_info.html b/doc/tutorial_enable_error_info.html index 868d42e..78e63e2 100644 --- a/doc/tutorial_enable_error_info.html +++ b/doc/tutorial_enable_error_info.html @@ -53,6 +53,7 @@ my_container diff --git a/doc/tutorial_transporting_data.html b/doc/tutorial_transporting_data.html index 7aa8b27..92e2ea3 100644 --- a/doc/tutorial_transporting_data.html +++ b/doc/tutorial_transporting_data.html @@ -21,7 +21,11 @@

Transporting of Arbitrary Data to the Catch Site

-

All exception types that derive from boost::exception 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. Data can be added to a boost::exception at the time of the throw, or at a later time.

+

All exception types that derive from boost::exception 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::exception, 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.
  • +

Adding of Arbitrary Data at the Point of the Throw

The following example demonstrates how errno can be stored in exception objects using Boost Exception:

diff --git a/doc/using_virtual_inheritance_in_exception_types.html b/doc/using_virtual_inheritance_in_exception_types.html new file mode 100644 index 0000000..a846220 --- /dev/null +++ b/doc/using_virtual_inheritance_in_exception_types.html @@ -0,0 +1,61 @@ + + + + + using virtual inheritance in exception types + + + +
+
+
+
+ +

Boost Exception

+
+ + + +

Using Virtual Inheritance in Exception Types

+
+

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::exception is used, because it enables exception types to be trivial structs with no members (there's nothing to initialize.) See Exception Types As Simple Semantic Tags.

+

+

See Also:

+ +
+ + + + +
+
+
+ + diff --git a/include/boost/exception/diagnostic_information.hpp b/include/boost/exception/diagnostic_information.hpp index 99273bc..af10837 100644 --- a/include/boost/exception/diagnostic_information.hpp +++ b/include/boost/exception/diagnostic_information.hpp @@ -6,6 +6,7 @@ #ifndef UUID_0552D49838DD11DD90146B8956D89593 #define UUID_0552D49838DD11DD90146B8956D89593 +#include #include #include #include @@ -22,13 +23,17 @@ boost get_diagnostic_information( exception const & x ) { if( error_info_container * c=x.data_.get() ) +#ifndef BOOST_NO_EXCEPTIONS try { +#endif return c->diagnostic_information(); +#ifndef BOOST_NO_EXCEPTIONS } catch(...) { } +#endif return 0; } }