Boost C++ Libraries of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of Boost. Click here to view this page for the latest version.
c++boost.gif (8819 bytes)



The header <boost/throw_exception.hpp> defines the helper function boost::throw_exception. It is intended to be used in Boost libraries that need to throw exceptions, but support configurations and platforms where exceptions aren't available, as indicated by the presence of the BOOST_NO_EXCEPTIONS configuration macro.

When BOOST_NO_EXCEPTIONS is not defined, boost::throw_exception(e) is equivalent to throw e. Otherwise, the function is left undefined, and the user is expected to supply an appropriate definition. Callers of throw_exception are allowed to assume that the function never returns; therefore, if the user-defined throw_exception returns, the behavior is undefined.


namespace boost


void throw_exception(std::exception const & e); // user defined


template<class E> void throw_exception(E const & e)
    throw e;



Copyright 2002 by Peter Dimov. Permission to copy, use, modify, sell and distribute this document is granted provided this copyright notice appears in all copies. This document is provided "as is" without express or implied warranty, and with no claim as to its suitability for any purpose.