| [29] | 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"><A href="../../index.htm"> <img src="../../boost.png" alt="boost.png (6897 bytes)" width="277" height="86" border="0"></A> |
|---|
| 11 | </td> |
|---|
| 12 | <td align="center"> |
|---|
| 13 | <h1>throw_exception.hpp</h1> |
|---|
| 14 | </td> |
|---|
| 15 | </tr> |
|---|
| 16 | <tr> |
|---|
| 17 | <td colspan="2" height="64"> </td> |
|---|
| 18 | </tr> |
|---|
| 19 | </table> |
|---|
| 20 | <p> |
|---|
| 21 | The header <STRONG><boost/throw_exception.hpp></STRONG> defines the |
|---|
| 22 | helper function <STRONG>boost::throw_exception</STRONG>. It is intended to be |
|---|
| 23 | used in Boost libraries that need to throw exceptions, but support |
|---|
| 24 | configurations and platforms where exceptions aren't available, as indicated by |
|---|
| 25 | the presence of the <STRONG>BOOST_NO_EXCEPTIONS</STRONG> <A href="../config/config.htm#macro_ref"> |
|---|
| 26 | configuration macro</A>. |
|---|
| 27 | </p> |
|---|
| 28 | <P>When <STRONG>BOOST_NO_EXCEPTIONS</STRONG> is not defined, <tt>boost::throw_exception(e)</tt> |
|---|
| 29 | is equivalent to <tt>throw e</tt>. Otherwise, the function is left undefined, |
|---|
| 30 | and the user is expected to supply an appropriate definition. Callers of <tt>throw_exception</tt> |
|---|
| 31 | are allowed to assume that the function never returns; therefore, if the |
|---|
| 32 | user-defined <tt>throw_exception</tt> returns, the behavior is undefined.</P> |
|---|
| 33 | <h3><a name="Synopsis">Synopsis</a></h3> |
|---|
| 34 | <pre> |
|---|
| 35 | namespace boost |
|---|
| 36 | { |
|---|
| 37 | |
|---|
| 38 | #ifdef BOOST_NO_EXCEPTIONS |
|---|
| 39 | |
|---|
| 40 | void throw_exception(std::exception const & e); // user defined |
|---|
| 41 | |
|---|
| 42 | #else |
|---|
| 43 | |
|---|
| 44 | template<class E> void throw_exception(E const & e) |
|---|
| 45 | { |
|---|
| 46 | throw e; |
|---|
| 47 | } |
|---|
| 48 | |
|---|
| 49 | #endif |
|---|
| 50 | |
|---|
| 51 | } |
|---|
| 52 | </pre> |
|---|
| 53 | <p><br> |
|---|
| 54 | <small>Copyright © 2002 by Peter Dimov. Distributed under the Boost Software License, Version |
|---|
| 55 | 1.0. See accompanying file <A href="../../LICENSE_1_0.txt">LICENSE_1_0.txt</A> or |
|---|
| 56 | copy at <A href="http://www.boost.org/LICENSE_1_0.txt">http://www.boost.org/LICENSE_1_0.txt</A>.</small></p> |
|---|
| 57 | </body> |
|---|
| 58 | </html> |
|---|