1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
---|
2 | <html> |
---|
3 | <head> |
---|
4 | <title>Boost: throw_exception.hpp documentation</title> |
---|
5 | <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> |
---|
6 | </head> |
---|
7 | <body bgcolor="white" style="MARGIN-LEFT: 5%; MARGIN-RIGHT: 5%"> |
---|
8 | <table border="0" width="100%"> |
---|
9 | <tr> |
---|
10 | <td width="277"> |
---|
11 | <img src="../../boost.png" alt="boost.png (6897 bytes)" width="277" height="86"> |
---|
12 | </td> |
---|
13 | <td align="middle"> |
---|
14 | <h1>throw_exception.hpp</h1> |
---|
15 | </td> |
---|
16 | </tr> |
---|
17 | <tr> |
---|
18 | <td colspan="2" height="64"> </td> |
---|
19 | </tr> |
---|
20 | </table> |
---|
21 | <p> |
---|
22 | The header <STRONG><boost/throw_exception.hpp></STRONG> defines the |
---|
23 | helper function <STRONG>boost::throw_exception</STRONG>. It is intended to be |
---|
24 | used in Boost libraries that need to throw exceptions, but support |
---|
25 | configurations and platforms where exceptions aren't available, as indicated by |
---|
26 | the presence of the <STRONG>BOOST_NO_EXCEPTIONS</STRONG> <A href="../config/config.htm#macro_ref"> |
---|
27 | configuration macro</A>. |
---|
28 | </p> |
---|
29 | <P>When <STRONG>BOOST_NO_EXCEPTIONS</STRONG> is not defined, <tt>boost::throw_exception(e)</tt> |
---|
30 | is equivalent to <tt>throw e</tt>. Otherwise, the function is left undefined, |
---|
31 | and the user is expected to supply an appropriate definition. Callers of <tt>throw_exception</tt> |
---|
32 | are allowed to assume that the function never returns; therefore, if the |
---|
33 | user-defined <tt>throw_exception</tt> returns, the behavior is undefined.</P> |
---|
34 | <h3><a name="Synopsis">Synopsis</a></h3> |
---|
35 | <pre> |
---|
36 | namespace boost |
---|
37 | { |
---|
38 | |
---|
39 | #ifdef BOOST_NO_EXCEPTIONS |
---|
40 | |
---|
41 | void throw_exception(std::exception const & e); // user defined |
---|
42 | |
---|
43 | #else |
---|
44 | |
---|
45 | template<class E> void throw_exception(E const & e) |
---|
46 | { |
---|
47 | throw e; |
---|
48 | } |
---|
49 | |
---|
50 | #endif |
---|
51 | |
---|
52 | } |
---|
53 | </pre> |
---|
54 | <p><br> |
---|
55 | <small>Copyright © 2002 by Peter Dimov. Permission to copy, use, modify, sell and |
---|
56 | distribute this document is granted provided this copyright notice appears in |
---|
57 | all copies. This document is provided "as is" without express or implied |
---|
58 | warranty, and with no claim as to its suitability for any purpose.</small></p> |
---|
59 | </body> |
---|
60 | </html> |
---|