From c3e35e9d3717bdb847c0c9a456facd615170553c Mon Sep 17 00:00:00 2001 From: Emil Dotchevski Date: Thu, 15 Mar 2012 02:13:52 +0000 Subject: [PATCH] Making clone_impl derive virtually from clone_base, so that calling boost::copy_exception with a type that already derives from clone_impl doesn't make pointer conversions to clone_impl ambiguous. [SVN r77339] --- doc/source/boost-exception.reno | 2402 ++++++++++++------------- include/boost/exception/exception.hpp | 2 +- 2 files changed, 1202 insertions(+), 1202 deletions(-) diff --git a/doc/source/boost-exception.reno b/doc/source/boost-exception.reno index f78597c..90dfa3a 100644 --- a/doc/source/boost-exception.reno +++ b/doc/source/boost-exception.reno @@ -48,201 +48,6 @@ reno_context - - - - - 1 - DB156E6A8ACB9FB90C8FB110FC25A5FEB14A619F82EEC47FF913373592E5CC3E - 240075319 - 6209 - 412 - - - - - 0 - ../../example/example_io.cpp - 0 - 0 - - - - - <string>diagnostic_information example</string> - - - - - - - - 0 - - - - 0 - - 6 - - reno_context - - - - - - 3 - 088B53C0FBDB55F55DCF1296B3206D748A2B2453CCFC3DAA2AA0FADD930561E7 - 3582349865 - 11956 - 527 - E0D734FE11CFB52F1BBF35C31E84A098AC93881DEE300CDBE3F9B772F75D9B2F - 4056200131 - 2307 - 4436 - A94129EFD6ABBDDCD4CFDB671821F7DA103B2EA4455CF39E783D333C236D1C41 - 1035445969 - 595 - 204 - - - - - 0 - ../../../../boost/exception/exception.hpp - 0 - 0 - - - - - <string>exception::exception</string> - - - exception_constructors - - - - - 1 - 2 - (:include include:) (:auto also:) - - - - 0 - - 7 - - reno_context - - - - - - 1 - 977045132A532A0071B0B53F737D85367CE9A331402F96790E45B3B6F2FC88A6 - 1875939463 - 529 - 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 - - 8 - - reno_context - - - - - - 0 - - - - - 1 - - - - - <string>page index</string> - - - page_idx - - - - - 1 - 2 - (:include include:) (:auto also:) - - - - 0 - - 9 - - reno_context - - - - - - 0 - - - - - 1 - - - - - <string>exception types as simple semantic tags</string> - - - - - - - - 1 - 2 - (:include include:) (:auto also:) - - - - 0 - - 10 - - reno_context - @@ -272,7 +77,30 @@ 0 - -9 + 6 + + reno_context + + + + + + 0 + + + + + 1 + + + + + <string>exception types as simple semantic tags</string> + + + + + 2 @@ -281,7 +109,7 @@ 0 - 11 + 7 reno_context @@ -320,7 +148,7 @@ 0 - 12 + 8 reno_context @@ -349,6 +177,204 @@ 2 ":) + + + 0 + + -7 + + + 1 + 2 + (:include include:) (:auto also:) + + + + 0 + + -8 + + + 1 + 2 + (:include include:) (:auto also:) + + + + 0 + + 9 + + reno_context + + + + + + 1 + 977045132A532A0071B0B53F737D85367CE9A331402F96790E45B3B6F2FC88A6 + 1875939463 + 529 + 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 + + 10 + + reno_context + + + + + + 3 + EFEF19E7D10F02079DA9799E42DA1415CA0C815E964E88CF1A8896D49C81EC22 + 2916767056 + 11964 + 527 + E0D734FE11CFB52F1BBF35C31E84A098AC93881DEE300CDBE3F9B772F75D9B2F + 4056200131 + 2307 + 4436 + A94129EFD6ABBDDCD4CFDB671821F7DA103B2EA4455CF39E783D333C236D1C41 + 1035445969 + 595 + 204 + + + + + 0 + ../../../../boost/exception/exception.hpp + 0 + 0 + + + + + <string>exception::exception</string> + + + exception_constructors + + + + + 1 + 2 + (:include include:) (:auto also:) + + + + 0 + + 11 + + reno_context + + + + + + 3 + EFBD8063574E7D463C8E08D9AA1D68CFCE4630C445B20156AC7591F46AB48260 + 2082877988 + 5081 + 751 + 2C6C9E29E4E23E6C1F5876C33741FB18A63E703410F3CD61ACB348866B7B02B8 + 3516588960 + 3918 + 884 + 38AA79D330846BE1CF17285796F34A9DBB5A7E995963A55F9B46EB1DA6314610 + 542483318 + 573 + 3130 + + + + + 0 + ../../../../boost/exception/info.hpp + 0 + 0 + + + + + <string>exception/operator<<</string> + + + + + + + + 1 + 2 + (:include include:) (:auto also:) + + + + 0 + + 12 + + reno_context + + + + + + 1 + DB156E6A8ACB9FB90C8FB110FC25A5FEB14A619F82EEC47FF913373592E5CC3E + 240075319 + 6209 + 412 + + + + + 0 + ../../example/example_io.cpp + 0 + 0 + + + + + <string>diagnostic_information example</string> + + + + + + + + 0 + 0 @@ -402,111 +428,6 @@ reno_context - - - - - 3 - EFBD8063574E7D463C8E08D9AA1D68CFCE4630C445B20156AC7591F46AB48260 - 2082877988 - 5081 - 751 - 2C6C9E29E4E23E6C1F5876C33741FB18A63E703410F3CD61ACB348866B7B02B8 - 3516588960 - 3918 - 884 - 38AA79D330846BE1CF17285796F34A9DBB5A7E995963A55F9B46EB1DA6314610 - 542483318 - 573 - 3130 - - - - - 0 - ../../../../boost/exception/info.hpp - 0 - 0 - - - - - <string>exception/operator<<</string> - - - - - - - - 1 - 2 - (:include include:) (:auto also:) - - - - 0 - - -11 - - - 1 - 2 - (:include include:) (:auto also:) - - - - 0 - - 15 - - 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> - - - - - - - - 1 - 2 - (:include include:) (:auto also:) - - - - 0 - - 16 - - reno_context - @@ -548,7 +469,82 @@ 0 - -12 + 15 + + reno_context + + + + + + 1 + 790A065B0168021FAD180E996254E3CDBC0360D22D3FCB83C143416663D85402 + 1376868984 + 262 + 323 + + + + + 0 + ../../../../boost/exception/errinfo_nested_exception.hpp + 0 + 0 + + + + + <string>boost/exception/errinfo_nested_exception.hpp</string> + + + + + + + + 1 + 2 + (:include include:) (:auto also:) + + + + 0 + + 16 + + reno_context + + + + + + 2 + 9A4ECF9A49A73AED83C1565CB8C67AE1519E8AFE6818F968B4C4733CB9E86CEF + 1615599655 + 68 + 321 + 34F0583BC8DE767CE2D79721E1F956895E43E5397473B1050F59BE7E26C773DB + 805836816 + 66 + 1 + + + + + 0 + ../../../../boost/exception/error_info.hpp + 0 + 0 + + + + + <string>boost/exception/error_info.hpp</string> + + + + + 1 @@ -600,6 +596,17 @@ 2 (:include include:) (:auto also:) + + + 0 + + -6 + + + 1 + 2 + (:include include:) (:auto also:) + 0 @@ -612,27 +619,20 @@ - 1 - 790A065B0168021FAD180E996254E3CDBC0360D22D3FCB83C143416663D85402 - 1376868984 - 262 - 323 + 0 - 0 - ../../../../boost/exception/errinfo_nested_exception.hpp - 0 - 0 + 1 - <string>boost/exception/errinfo_nested_exception.hpp</string> + <string>page index</string> - + page_idx @@ -922,9 +922,9 @@ 3 - 088B53C0FBDB55F55DCF1296B3206D748A2B2453CCFC3DAA2AA0FADD930561E7 - 3582349865 - 11956 + EFEF19E7D10F02079DA9799E42DA1415CA0C815E964E88CF1A8896D49C81EC22 + 2916767056 + 11964 527 E0D734FE11CFB52F1BBF35C31E84A098AC93881DEE300CDBE3F9B772F75D9B2F 4056200131 @@ -1139,10 +1139,10 @@ 1 - 9A6D5598D65F1C1B5F913007D1CD1A814F3CDAD07D4AF8C468A0716059B2F7CC - 3552995087 - 1405 - 527 + 195FF369BA559E3C0080F75321794B4808B6A278D4DEF8AEDBD9FCEBCE69C548 + 458631219 + 2145 + 321 @@ -1624,13 +1624,13 @@ 2 - F7633FDCF6615C0199645701EE6E7ACE5CBCD7A7CF6838573791E91ABB3C09F2 - 1668435395 - 1332 + 1B4417301AE3C0338C22E6D497391F51ABD459E521E7DFCE59A6EEC1372D33C2 + 202224383 + 1766 600 - A1F443AF571973A12005D2F7D4AE09A32AAF686FEEAE272EC21512A65EB943E8 - 3879093659 - 1300 + E0A17503B42EE12F31548A7D20F89916D734CE88B30A1BF6F9FC2D1F83A8B6F4 + 3410340567 + 1734 26 @@ -2117,9 +2117,9 @@ 2 - 088B53C0FBDB55F55DCF1296B3206D748A2B2453CCFC3DAA2AA0FADD930561E7 - 3582349865 - 11956 + EFEF19E7D10F02079DA9799E42DA1415CA0C815E964E88CF1A8896D49C81EC22 + 2916767056 + 11964 527 F3FB15CD82336271C6E875BC620385322777D16F0B7C233300783CE35710CCBF 3292878997 @@ -2330,14 +2330,14 @@ 2 - 088B53C0FBDB55F55DCF1296B3206D748A2B2453CCFC3DAA2AA0FADD930561E7 - 3582349865 - 11956 + EFEF19E7D10F02079DA9799E42DA1415CA0C815E964E88CF1A8896D49C81EC22 + 2916767056 + 11964 527 DF9EA87B0140AACF4422F1B76F6A6A409C15F32858BBBA85A35981A824C56BA9 1137981799 192 - 11758 + 11766 @@ -2665,9 +2665,9 @@ 2 - 088B53C0FBDB55F55DCF1296B3206D748A2B2453CCFC3DAA2AA0FADD930561E7 - 3582349865 - 11956 + EFEF19E7D10F02079DA9799E42DA1415CA0C815E964E88CF1A8896D49C81EC22 + 2916767056 + 11964 527 17E691632123EB67BA67D590B49EB8094F462F5A10A66A1C5438E1867EF1478E 765399792 @@ -2947,9 +2947,9 @@ 1 - 088B53C0FBDB55F55DCF1296B3206D748A2B2453CCFC3DAA2AA0FADD930561E7 - 3582349865 - 11956 + EFEF19E7D10F02079DA9799E42DA1415CA0C815E964E88CF1A8896D49C81EC22 + 2916767056 + 11964 527 @@ -3247,15 +3247,6 @@ 0 - - - 0 - - -6 - - - 0 - 0 @@ -3292,6 +3283,24 @@ 0 + + + 0 + + -11 + + + 0 + + + + 0 + + -12 + + + 0 + 0 @@ -3330,15 +3339,6 @@ 0 - - - 0 - - -11 - - - 0 - 0 @@ -3361,7 +3361,7 @@ 0 - -12 + -17 0 @@ -3370,7 +3370,7 @@ 0 - -17 + -6 0 @@ -3501,7 +3501,7 @@ 0 - -6 + -10 2 @@ -4181,15 +4181,6 @@ 0 - - - 0 - - -6 - - - 0 - 0 @@ -4226,6 +4217,24 @@ 0 + + + 0 + + -11 + + + 0 + + + + 0 + + -12 + + + 0 + 0 @@ -4248,16 +4257,27 @@ 0 - -11 + -15 - 0 + 3 + 2 + [@(:include + 1 + + 0 + + -63 + + + 2 + def:)@] 0 - -15 + -16 3 @@ -4273,24 +4293,6 @@ 2 decl:)@] - - - 0 - - -16 - - - 0 - - - - 0 - - -12 - - - 0 - 0 @@ -4300,6 +4302,15 @@ 0 + + + 0 + + -6 + + + 0 + 0 @@ -4307,18 +4318,7 @@ -18 - 3 - 2 - [@(:include - 1 - - 0 - - -63 - - - 2 - def:)@] + 0 @@ -4851,7 +4851,7 @@ 0 - -16 + -14 2 @@ -4889,7 +4889,7 @@ 0 - -14 + -11 2 @@ -5158,7 +5158,7 @@ 0 - -15 + -16 2 @@ -5275,7 +5275,7 @@ 0 - -18 + -15 2 @@ -5351,44 +5351,6 @@ 0 - - - 0 - - -6 - - - 7 - 2 - [@(:link - 1 - - 0 - - -6 - - - 2 - mod="m":)(); (:link - 1 - - 0 - - -6 - - - 2 - mod="m":)( (:link - 1 - - 0 - - -25 - - - 2 - :) const & x );@] - 0 @@ -5423,22 +5385,42 @@ -10 - 0 - - + 7 + 2 + [@(:link + 1 0 - -13 + -10 - 0 + 2 + mod="m":)(); (:link + 1 + + 0 + + -10 + + + 2 + mod="m":)( (:link + 1 + + 0 + + -25 + + + 2 + :) const & x );@] 0 - -14 + -11 5 @@ -5448,7 +5430,7 @@ 0 - -14 + -11 2 @@ -5467,11 +5449,40 @@ 0 - -11 + -12 0 + + + 0 + + -13 + + + 0 + + + + 0 + + -14 + + + 3 + 2 + [@template <class E> E * + 1 + + 0 + + -14 + + + 2 + ();@] + 0 @@ -5488,26 +5499,6 @@ -16 - 3 - 2 - [@template <class E> E * - 1 - - 0 - - -16 - - - 2 - ();@] - - - - 0 - - -12 - - 0 @@ -5539,6 +5530,15 @@ 2 mod="m":) const & v );@] + + + 0 + + -6 + + + 0 + 0 @@ -6536,232 +6536,6 @@ -5 - 11 - 2 - !!!!Example: this is a possible output from the (:link - 1 - - 0 - - -34 - - - 2 - :) function, as used in ''libs/exception/example/example_io.cpp:'' [@example_io.cpp(70): Throw in function class boost::shared_ptr<struct _iobuf> __cdecl my_fopen(const char *,const char *) Dynamic exception type: class boost::exception_detail::clone_impl<struct fopen_error> std::exception::what: example_io error [struct boost::(:link - 1 - - 0 - - -32 - - - 2 - :)_ *] = fopen [struct boost::(:link - 1 - - 0 - - -13 - - - 2 - :)_ *] = 2, "No such file or directory" [struct boost::(:link - 1 - - 0 - - -72 - - - 2 - :)_ *] = tmp1.txt [struct boost::(:link - 1 - - 0 - - -22 - - - 2 - :)_ *] = rb@] - - - - 0 - - -6 - - - 7 - 2 - (:auto !!!:) (:include decl:) !!!!Effects: * Default constructor: initializes an empty boost::(:link - 1 - - 0 - - -25 - - - 2 - :) object. * Copy constructor: initializes a boost::(:link - 1 - - 0 - - -25 - - - 2 - :) object which shares ownership with x of all data added through (:link - 1 - - 0 - - -14 - - - 2 - mod="/":), including data that is added at a future time. !!!!Throws: Nothing. - - - - 0 - - -7 - - - 17 - 2 - (:auto !!!:) The following example demonstrates how errno can be stored in exception objects using Boost Exception: [@#include <(:link - 1 - - 0 - - -77 - - - 2 - :)> #include <iostream> typedef boost::(:link - 1 - - 0 - - -26 - - - 2 - :)<struct tag_my_info,int> my_info; //(1) struct my_error: virtual boost::(:link - 1 - - 0 - - -25 - - - 2 - :), virtual std::exception { }; //(2) void f() { throw my_error() << my_info(42); //(3) }@] First, we instantiate the (:link - 1 - - 0 - - -26 - - - 2 - :) template using a unique identifier -- tag_my_info, 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 - - -25 - - - 2 - :). Finally, (3) illustrates how the typedef from (1) can be used with (:link - 1 - - 0 - - -14 - - - 2 - |operator<<:) to store values in exception objects at the point of the throw. The stored my_info value can be recovered at a later time like this: [@// ...continued void g() { try { f(); } catch( my_error & x ) { if( int const * mi=boost::(:link - 1 - - 0 - - -20 - - - 2 - :)<my_info>(x) ) std::cerr << "My info: " << *mi; } }@] The (:link - 1 - - 0 - - -20 - - - 2 - :) function template is instantiated with the typedef from (1), and is passed an exception object of a polymorphic type. If the exception object contains the requested value, err will point to it; otherwise a null pointer is returned. - - - - 0 - - -8 - - - 1 - 2 - (:auto !:) This is an alphabetical list of all Boost Exception documentation pages. (:pagelist fmt="index" except_tags="index noindex" mod="w":) - - - - 0 - - -9 - - - 7 - 2 - (:auto !!!:) Deriving from boost::(:link - 1 - - 0 - - -25 - - - 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 - - -25 - - - 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 - - -25 - - - 2 - :) { }; struct io_error: virtual exception_base { }; struct file_error: virtual io_error { }; struct read_error: virtual io_error { }; struct file_read_error: virtual file_error, virtual read_error { };@] Using this approach, exception types become a simple tagging system for categorizing errors and selecting failures in exception handlers. - - - - 0 - - -10 - - 33 2 (:auto !!!:) Traditionally, when using exceptions to report failures, the throw site: *creates an exception object of the appropriate type, and *stuffs it with data relevant to the detected error. A higher context in the program contains a catch statement which: *selects failures based on exception types, and *inspects exception objects for data required to deal with the problem. The main issue with this "traditional" approach is that often, the data available at the point of the throw is insufficient for the catch site to handle the failure. Here is an example of a catch statement: [@catch( file_read_error & e ) { std::cerr << e.file_name(); }@] And here is a possible matching throw: [@void read_file( FILE * f ) { .... size_t nr=fread(buf,1,count,f); if( ferror(f) ) throw file_read_error(???); .... }@] Clearly, the problem is that the handler requires a file name but the read_file function does not have a file name to put in the exception object; all it has is a FILE pointer! In an attempt to deal with this problem, we could modify read_file to accept a file name: [@void read_file( FILE * f, char const * name ) { .... size_t nr=fread(buf,1,count,f); if( ferror(f) ) throw file_read_error(name); .... }@] This is not a real solution: it simply shifts the burden of supplying a file name to the immediate caller of the read_file function. ->''In general, the data required to handle a given library-emitted exception depends on the program that links to it. Many contexts between the throw and the catch may have relevant information which must be transported to the exception handler.'' !!!Exception wrapping The idea of exception wrapping is to catch an exception from a lower level function (such as the read_file function above), and throw a new exception object that contains the original exception (and also carries a file name.) This method seems to be particularly popular with C++ programmers with Java background. Exception wrapping leads to the following problems: *To wrap an exception object it must be copied, which may result in slicing. *Wrapping is practically impossible to use in generic contexts. The second point is actually special case of violating the exception neutrality principle. Most contexts in a program can not handle exceptions; such contexts should not interfere with the process of exception handling. !!!The boost::exception solution *Simply derive your exception types from boost::(:link @@ -6796,7 +6570,7 @@ 0 - -14 + -11 2 @@ -6832,7 +6606,7 @@ 0 - -14 + -11 2 @@ -6850,7 +6624,7 @@ 0 - -14 + -11 2 @@ -6914,83 +6688,7 @@ 0 - -13 - - - 7 - 2 - (:auto !!!:) (:include synopsis:) This type is designed to be used as a standard (:link - 1 - - 0 - - -26 - - - 2 - :) instance for transporting a relevant errno value in exceptions deriving from boost::(:link - 1 - - 0 - - -25 - - - 2 - :). !!!Example: (:include - 1 - - 0 - - -60 - - - 2 - :) - - - - 0 - - -14 - - - 7 - 2 - (:auto !!!:) (:include synopsis:) !!!!Requirements: E must be boost::(:link - 1 - - 0 - - -25 - - - 2 - :), or a type that derives (indirectly) from boost::(:link - 1 - - 0 - - -25 - - - 2 - :). !!!!Postcondition: A copy of v is stored into x. If x already contains data of type (:link - 1 - - 0 - - -26 - - - 2 - :)<Tag,T>, that data is overwritten. Basic exception safety guarantee. !!!!Returns: x. (:include throws:) - - - - 0 - - -11 + -7 27 @@ -7090,7 +6788,7 @@ 0 - -14 + -11 2 @@ -7118,29 +6816,7 @@ 0 - -15 - - - 1 - 2 - (:auto !!:) !!!Synopsis (:include synopsis:) - - - - 0 - - -16 - - - 1 - 2 - (:auto !!!:) (:include synopsis:) !!!!Requirements: This function must not be called outside of a catch block. !!!!Returns: A pointer of type E to the current exception object, or null if the current exception object can not be converted to E *. !!!!Throws: Nothing. - - - - 0 - - -12 + -8 81 @@ -7204,7 +6880,7 @@ 0 - -14 + -11 2 @@ -7231,7 +6907,7 @@ 0 - -14 + -11 2 @@ -7456,7 +7132,7 @@ 0 - -14 + -11 2 @@ -7465,7 +7141,7 @@ 0 - -14 + -11 2 @@ -7474,7 +7150,7 @@ 0 - -14 + -11 2 @@ -7483,7 +7159,7 @@ 0 - -14 + -11 2 @@ -7492,7 +7168,7 @@ 0 - -14 + -11 2 @@ -7507,6 +7183,292 @@ 2 :) wrapper, a std::bad_alloc could propagate instead. This behavior seems undesirable to some programmers. Bjarne Stroustrup, The C++ Programming Language, 3rd Edition, page 371: ->''"Throwing an exception requires an object to throw. A C++ implementation is required to have enough spare memory to be able to throw bad_alloc in case of memory exhaustion. However, it is possible that throwing some other exception will cause memory exhaustion."'' Therefore, the language itself does not guarantee that an attempt to throw an exception is guaranteed to throw an object of the specified type; propagating a std::bad_alloc seems to be a possibility even outside of the scope of Boost Exception. + + + 0 + + -9 + + + 17 + 2 + (:auto !!!:) The following example demonstrates how errno can be stored in exception objects using Boost Exception: [@#include <(:link + 1 + + 0 + + -77 + + + 2 + :)> #include <iostream> typedef boost::(:link + 1 + + 0 + + -26 + + + 2 + :)<struct tag_my_info,int> my_info; //(1) struct my_error: virtual boost::(:link + 1 + + 0 + + -25 + + + 2 + :), virtual std::exception { }; //(2) void f() { throw my_error() << my_info(42); //(3) }@] First, we instantiate the (:link + 1 + + 0 + + -26 + + + 2 + :) template using a unique identifier -- tag_my_info, 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 + + -25 + + + 2 + :). Finally, (3) illustrates how the typedef from (1) can be used with (:link + 1 + + 0 + + -11 + + + 2 + |operator<<:) to store values in exception objects at the point of the throw. The stored my_info value can be recovered at a later time like this: [@// ...continued void g() { try { f(); } catch( my_error & x ) { if( int const * mi=boost::(:link + 1 + + 0 + + -20 + + + 2 + :)<my_info>(x) ) std::cerr << "My info: " << *mi; } }@] The (:link + 1 + + 0 + + -20 + + + 2 + :) function template is instantiated with the typedef from (1), and is passed an exception object of a polymorphic type. If the exception object contains the requested value, err will point to it; otherwise a null pointer is returned. + + + + 0 + + -10 + + + 7 + 2 + (:auto !!!:) (:include decl:) !!!!Effects: * Default constructor: initializes an empty boost::(:link + 1 + + 0 + + -25 + + + 2 + :) object. * Copy constructor: initializes a boost::(:link + 1 + + 0 + + -25 + + + 2 + :) object which shares ownership with x of all data added through (:link + 1 + + 0 + + -11 + + + 2 + mod="/":), including data that is added at a future time. !!!!Throws: Nothing. + + + + 0 + + -11 + + + 7 + 2 + (:auto !!!:) (:include synopsis:) !!!!Requirements: E must be boost::(:link + 1 + + 0 + + -25 + + + 2 + :), or a type that derives (indirectly) from boost::(:link + 1 + + 0 + + -25 + + + 2 + :). !!!!Postcondition: A copy of v is stored into x. If x already contains data of type (:link + 1 + + 0 + + -26 + + + 2 + :)<Tag,T>, that data is overwritten. Basic exception safety guarantee. !!!!Returns: x. (:include throws:) + + + + 0 + + -12 + + + 11 + 2 + !!!!Example: this is a possible output from the (:link + 1 + + 0 + + -34 + + + 2 + :) function, as used in ''libs/exception/example/example_io.cpp:'' [@example_io.cpp(70): Throw in function class boost::shared_ptr<struct _iobuf> __cdecl my_fopen(const char *,const char *) Dynamic exception type: class boost::exception_detail::clone_impl<struct fopen_error> std::exception::what: example_io error [struct boost::(:link + 1 + + 0 + + -32 + + + 2 + :)_ *] = fopen [struct boost::(:link + 1 + + 0 + + -13 + + + 2 + :)_ *] = 2, "No such file or directory" [struct boost::(:link + 1 + + 0 + + -72 + + + 2 + :)_ *] = tmp1.txt [struct boost::(:link + 1 + + 0 + + -22 + + + 2 + :)_ *] = rb@] + + + + 0 + + -13 + + + 7 + 2 + (:auto !!!:) (:include synopsis:) This type is designed to be used as a standard (:link + 1 + + 0 + + -26 + + + 2 + :) instance for transporting a relevant errno value in exceptions deriving from boost::(:link + 1 + + 0 + + -25 + + + 2 + :). !!!Example: (:include + 1 + + 0 + + -60 + + + 2 + :) + + + + 0 + + -14 + + + 1 + 2 + (:auto !!!:) (:include synopsis:) !!!!Requirements: This function must not be called outside of a catch block. !!!!Returns: A pointer of type E to the current exception object, or null if the current exception object can not be converted to E *. !!!!Throws: Nothing. + + + + 0 + + -15 + + + 1 + 2 + (:auto !!:) !!!Synopsis (:include synopsis:) + + + + 0 + + -16 + + + 1 + 2 + (:auto !!:) !!!Synopsis (:include synopsis:) + 0 @@ -7527,6 +7489,44 @@ 2 object. (:include throws:) + + + 0 + + -6 + + + 7 + 2 + (:auto !!!:) Deriving from boost::(:link + 1 + + 0 + + -25 + + + 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 + + -25 + + + 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 + + -25 + + + 2 + :) { }; struct io_error: virtual exception_base { }; struct file_error: virtual io_error { }; struct read_error: virtual io_error { }; struct file_read_error: virtual file_error, virtual read_error { };@] Using this approach, exception types become a simple tagging system for categorizing errors and selecting failures in exception handlers. + 0 @@ -7536,7 +7536,7 @@ 1 2 - (:auto !!:) !!!Synopsis (:include synopsis:) + (:auto !:) This is an alphabetical list of all Boost Exception documentation pages. (:pagelist fmt="index" except_tags="index noindex" mod="w":) @@ -7608,7 +7608,7 @@ 0 - -14 + -11 2 @@ -7951,7 +7951,7 @@ 0 - -14 + -11 2 @@ -7998,7 +7998,7 @@ 0 - -14 + -11 2 @@ -8016,7 +8016,7 @@ 0 - -15 + -16 2 @@ -8034,7 +8034,7 @@ 0 - -15 + -16 2 @@ -8052,7 +8052,7 @@ 0 - -15 + -16 2 @@ -8070,7 +8070,7 @@ 0 - -14 + -11 2 @@ -8097,7 +8097,7 @@ 0 - -14 + -11 2 @@ -8160,7 +8160,7 @@ 0 - -14 + -11 2 @@ -8300,7 +8300,7 @@ 0 - -10 + -5 2 @@ -8318,7 +8318,7 @@ 0 - -11 + -7 2 @@ -8336,7 +8336,7 @@ 0 - -9 + -6 2 @@ -8399,7 +8399,7 @@ 0 - -14 + -11 2 @@ -8507,7 +8507,7 @@ 0 - -16 + -14 2 @@ -8570,7 +8570,7 @@ 0 - -12 + -8 2 @@ -8579,7 +8579,7 @@ 0 - -8 + -18 2 @@ -8626,7 +8626,7 @@ 0 - -14 + -11 2 @@ -8752,7 +8752,7 @@ 0 - -5 + -12 2 @@ -8790,7 +8790,7 @@ 0 - -15 + -16 2 @@ -8799,7 +8799,7 @@ 0 - -15 + -16 2 @@ -9060,7 +9060,7 @@ 0 - -18 + -15 2 @@ -9069,7 +9069,7 @@ 0 - -18 + -15 2 @@ -9237,7 +9237,7 @@ 0 - -9 + -6 2 @@ -10002,7 +10002,7 @@ 0 - -14 + -11 2 @@ -10047,7 +10047,7 @@ 0 - -5 + -12 2 @@ -10783,7 +10783,7 @@ 0 - -7 + -9 2 @@ -11024,15 +11024,6 @@ 0 - - - 0 - - -6 - - - 0 - 0 @@ -11073,16 +11064,7 @@ 0 - -13 - - - 0 - - - - 0 - - -14 + -11 1 @@ -11093,7 +11075,25 @@ 0 - -11 + -12 + + + 0 + + + + 0 + + -13 + + + 0 + + + + 0 + + -14 0 @@ -11116,15 +11116,6 @@ 0 - - - 0 - - -12 - - - 0 - 0 @@ -11136,6 +11127,15 @@ 2 !!!!Throws: Any exception emitted by v's copy constructor. + + + 0 + + -6 + + + 0 + 0 @@ -11728,15 +11728,6 @@ 0 - - - 0 - - -6 - - - 0 - 0 @@ -11773,6 +11764,35 @@ 0 + + + 0 + + -11 + + + 3 + 2 + `#include <(:link + 1 + + 0 + + -57 + + + 2 + :)>\\ [@namespace boost { (:include decl pre_indent="4":) }@] + + + + 0 + + -12 + + + 0 + 0 @@ -11811,46 +11831,6 @@ 3 2 - `#include <(:link - 1 - - 0 - - -57 - - - 2 - :)>\\ [@namespace boost { (:include decl pre_indent="4":) }@] - - - - 0 - - -11 - - - 0 - - - - 0 - - -15 - - - 1 - 2 - [@namespace boost { (:include api pre_indent="4":) }@] - - - - 0 - - -16 - - - 3 - 2 `#include < 1 @@ -11866,10 +11846,41 @@ 0 - -12 + -15 - 0 + 5 + 2 + [@#include <(:link + 1 + + 0 + + -16 + + + 2 + :)> namespace boost { (:include + 1 + + 0 + + -21 + + + 2 + decl pre_indent="4":) (:include api pre_indent="4":) }@] + + + + 0 + + -16 + + + 1 + 2 + [@namespace boost { (:include api pre_indent="4":) }@] @@ -11891,6 +11902,15 @@ 2 :)> [@(:include decl:)@] + + + 0 + + -6 + + + 0 + 0 @@ -11898,27 +11918,7 @@ -18 - 5 - 2 - [@#include <(:link - 1 - - 0 - - -15 - - - 2 - :)> namespace boost { (:include - 1 - - 0 - - -21 - - - 2 - decl pre_indent="4":) (:include api pre_indent="4":) }@] + 0 @@ -12112,7 +12112,7 @@ 0 - -15 + -16 2 @@ -12152,7 +12152,7 @@ 0 - -15 + -16 2 @@ -12315,7 +12315,7 @@ 0 - -15 + -16 2 @@ -12422,7 +12422,7 @@ 0 - -15 + -16 2 @@ -12482,7 +12482,7 @@ 0 - -15 + -16 2 @@ -12689,7 +12689,7 @@ 0 - -18 + -15 2 @@ -12698,7 +12698,7 @@ 0 - -18 + -15 2 @@ -12718,7 +12718,7 @@ 0 - -15 + -16 2 @@ -12974,7 +12974,7 @@ 0 - -15 + -16 2 @@ -13010,9 +13010,6 @@ -5 - - -6 - -7 @@ -13025,15 +13022,18 @@ -10 + + -11 + + + -12 + -13 -14 - - -11 - -15 @@ -13041,10 +13041,10 @@ -16 - -12 + -17 - -17 + -6 -18 @@ -13297,7 +13297,7 @@ - -8 + -18 @@ -13342,7 +13342,7 @@ - -10 + -5 @@ -13372,7 +13372,7 @@ - -9 + -6 @@ -13387,7 +13387,7 @@ - -12 + -8 @@ -13484,7 +13484,7 @@ - -18 + -15 @@ -13653,6 +13653,166 @@ -51 + + + + 1 + EFEF19E7D10F02079DA9799E42DA1415CA0C815E964E88CF1A8896D49C81EC22 + 2916767056 + 11964 + 527 + + + + + 0 + ../../../../boost/exception/exception.hpp + 0 + 0 + + + + -74 + + + + + + 3 + EFEF19E7D10F02079DA9799E42DA1415CA0C815E964E88CF1A8896D49C81EC22 + 2916767056 + 11964 + 527 + E0D734FE11CFB52F1BBF35C31E84A098AC93881DEE300CDBE3F9B772F75D9B2F + 4056200131 + 2307 + 4436 + A94129EFD6ABBDDCD4CFDB671821F7DA103B2EA4455CF39E783D333C236D1C41 + 1035445969 + 595 + 204 + + + + + 0 + ../../../../boost/exception/exception.hpp + 0 + 0 + + + + -10 + + + + + + 3 + EFEF19E7D10F02079DA9799E42DA1415CA0C815E964E88CF1A8896D49C81EC22 + 2916767056 + 11964 + 527 + E0D734FE11CFB52F1BBF35C31E84A098AC93881DEE300CDBE3F9B772F75D9B2F + 4056200131 + 2307 + 4436 + 28ACC7E8903AFA473B656DAD74C22C3F675AFCCA871D81AB3AB7742FDF5F1E48 + 2824899226 + 2163 + 145 + + + + + 0 + ../../../../boost/exception/exception.hpp + 0 + 0 + + + + -25 + + + + + + 2 + EFEF19E7D10F02079DA9799E42DA1415CA0C815E964E88CF1A8896D49C81EC22 + 2916767056 + 11964 + 527 + 17E691632123EB67BA67D590B49EB8094F462F5A10A66A1C5438E1867EF1478E + 765399792 + 77 + 6878 + + + + + 0 + ../../../../boost/exception/exception.hpp + 0 + 0 + + + + -67 + + + + + + 2 + EFEF19E7D10F02079DA9799E42DA1415CA0C815E964E88CF1A8896D49C81EC22 + 2916767056 + 11964 + 527 + DF9EA87B0140AACF4422F1B76F6A6A409C15F32858BBBA85A35981A824C56BA9 + 1137981799 + 192 + 11766 + + + + + 0 + ../../../../boost/exception/exception.hpp + 0 + 0 + + + + -59 + + + + + + 2 + EFEF19E7D10F02079DA9799E42DA1415CA0C815E964E88CF1A8896D49C81EC22 + 2916767056 + 11964 + 527 + F3FB15CD82336271C6E875BC620385322777D16F0B7C233300783CE35710CCBF + 3292878997 + 282 + 9272 + + + + + 0 + ../../../../boost/exception/exception.hpp + 0 + 0 + + + + -54 + + @@ -13764,7 +13924,7 @@ - -16 + -14 @@ -13786,7 +13946,7 @@ - -5 + -12 @@ -13837,6 +13997,28 @@ -39 + + + + 1 + 195FF369BA559E3C0080F75321794B4808B6A278D4DEF8AEDBD9FCEBCE69C548 + 458631219 + 2145 + 321 + + + + + 0 + ../../../../boost/exception/info_tuple.hpp + 0 + 0 + + + + -30 + + @@ -14146,7 +14328,7 @@ - -14 + -11 @@ -14460,7 +14642,7 @@ - -7 + -9 @@ -14615,6 +14797,32 @@ -55 + + + + 2 + 1B4417301AE3C0338C22E6D497391F51ABD459E521E7DFCE59A6EEC1372D33C2 + 202224383 + 1766 + 600 + E0A17503B42EE12F31548A7D20F89916D734CE88B30A1BF6F9FC2D1F83A8B6F4 + 3410340567 + 1734 + 26 + + + + + 0 + ../../../../boost/exception/info_tuple.hpp + 0 + 0 + + + + -42 + + @@ -14637,28 +14845,6 @@ -66 - - - - 1 - 9A6D5598D65F1C1B5F913007D1CD1A814F3CDAD07D4AF8C468A0716059B2F7CC - 3552995087 - 1405 - 527 - - - - - 0 - ../../../../boost/exception/info_tuple.hpp - 0 - 0 - - - - -30 - - @@ -14685,166 +14871,6 @@ -72 - - - - 1 - 088B53C0FBDB55F55DCF1296B3206D748A2B2453CCFC3DAA2AA0FADD930561E7 - 3582349865 - 11956 - 527 - - - - - 0 - ../../../../boost/exception/exception.hpp - 0 - 0 - - - - -74 - - - - - - 3 - 088B53C0FBDB55F55DCF1296B3206D748A2B2453CCFC3DAA2AA0FADD930561E7 - 3582349865 - 11956 - 527 - E0D734FE11CFB52F1BBF35C31E84A098AC93881DEE300CDBE3F9B772F75D9B2F - 4056200131 - 2307 - 4436 - A94129EFD6ABBDDCD4CFDB671821F7DA103B2EA4455CF39E783D333C236D1C41 - 1035445969 - 595 - 204 - - - - - 0 - ../../../../boost/exception/exception.hpp - 0 - 0 - - - - -6 - - - - - - 3 - 088B53C0FBDB55F55DCF1296B3206D748A2B2453CCFC3DAA2AA0FADD930561E7 - 3582349865 - 11956 - 527 - E0D734FE11CFB52F1BBF35C31E84A098AC93881DEE300CDBE3F9B772F75D9B2F - 4056200131 - 2307 - 4436 - 28ACC7E8903AFA473B656DAD74C22C3F675AFCCA871D81AB3AB7742FDF5F1E48 - 2824899226 - 2163 - 145 - - - - - 0 - ../../../../boost/exception/exception.hpp - 0 - 0 - - - - -25 - - - - - - 2 - 088B53C0FBDB55F55DCF1296B3206D748A2B2453CCFC3DAA2AA0FADD930561E7 - 3582349865 - 11956 - 527 - 17E691632123EB67BA67D590B49EB8094F462F5A10A66A1C5438E1867EF1478E - 765399792 - 77 - 6878 - - - - - 0 - ../../../../boost/exception/exception.hpp - 0 - 0 - - - - -67 - - - - - - 2 - 088B53C0FBDB55F55DCF1296B3206D748A2B2453CCFC3DAA2AA0FADD930561E7 - 3582349865 - 11956 - 527 - DF9EA87B0140AACF4422F1B76F6A6A409C15F32858BBBA85A35981A824C56BA9 - 1137981799 - 192 - 11758 - - - - - 0 - ../../../../boost/exception/exception.hpp - 0 - 0 - - - - -59 - - - - - - 2 - 088B53C0FBDB55F55DCF1296B3206D748A2B2453CCFC3DAA2AA0FADD930561E7 - 3582349865 - 11956 - 527 - F3FB15CD82336271C6E875BC620385322777D16F0B7C233300783CE35710CCBF - 3292878997 - 282 - 9272 - - - - - 0 - ../../../../boost/exception/exception.hpp - 0 - 0 - - - - -54 - - @@ -14864,7 +14890,7 @@ - -11 + -7 @@ -14874,7 +14900,7 @@ 9A4ECF9A49A73AED83C1565CB8C67AE1519E8AFE6818F968B4C4733CB9E86CEF 1615599655 68 - 227 + 321 34F0583BC8DE767CE2D79721E1F956895E43E5397473B1050F59BE7E26C773DB 805836816 66 @@ -14890,33 +14916,7 @@ - -15 - - - - - - 2 - F7633FDCF6615C0199645701EE6E7ACE5CBCD7A7CF6838573791E91ABB3C09F2 - 1668435395 - 1332 - 600 - A1F443AF571973A12005D2F7D4AE09A32AAF686FEEAE272EC21512A65EB943E8 - 3879093659 - 1300 - 26 - - - - - 0 - ../../../../boost/exception/info_tuple.hpp - 0 - 0 - - - - -42 + -16 @@ -14992,16 +14992,16 @@ 0 - -6 + -7 - function + tutorial 0 - -7 + -9 noalso noindex tutorial @@ -15010,10 +15010,19 @@ 0 - -8 + -10 - + function + + + + 0 + + -11 + + + error_info free function @@ -15031,25 +15040,7 @@ -14 - error_info free function - - - - 0 - - -11 - - - tutorial - - - - 0 - - -15 - - - + function @@ -15058,7 +15049,7 @@ -16 - function + @@ -15069,6 +15060,15 @@ function member + + + 0 + + -18 + + + + 0 diff --git a/include/boost/exception/exception.hpp b/include/boost/exception/exception.hpp index 8967754..42d2787 100644 --- a/include/boost/exception/exception.hpp +++ b/include/boost/exception/exception.hpp @@ -430,7 +430,7 @@ boost class clone_impl: public T, - public clone_base + public virtual clone_base { struct clone_tag { }; clone_impl( clone_impl const & x, clone_tag ):