<p>The <tt><spanclass="RenoLink"><ahref="current_exception.html">current_exception</a></span>()</tt> function must not be called outside of a <tt>catch</tt> block.</p>
<h4>Returns:</h4>
<div><ul><li> An <tt><spanclass="RenoLink"><ahref="exception_ptr.html">exception_ptr</a></span></tt> that refers to the currently handled exception or a copy of the currently handled exception.</li>
<li> If the function needs to allocate memory and the attempt fails, it returns an <tt><spanclass="RenoLink"><ahref="exception_ptr.html">exception_ptr</a></span></tt> that refers to an instance of <tt>std::bad_alloc</tt>.</li>
</ul></div>
<h4>Notes:</h4>
<div><ul><li> It is unspecified whether the return values of two successive calls to <tt><spanclass="RenoLink"><ahref="current_exception.html">current_exception</a></span>()</tt> refer to the same exception object.</li>
<li> Correct implementation of <tt><spanclass="RenoLink"><ahref="current_exception.html">current_exception</a></span>()</tt> may require compiler support, unless <tt><spanclass="RenoLink"><ahref="enable_current_exception.html">enable_current_exception</a></span>()</tt> is used at the time the currently handled exception object was passed to <tt>throw</tt>. If <tt><spanclass="RenoLink"><ahref="enable_current_exception.html">enable_current_exception</a></span>()</tt> is not used, and if the compiler does not provide the necessary support, then <tt><spanclass="RenoLink"><ahref="current_exception.html">current_exception</a></span>()</tt> may return an <tt><spanclass="RenoLink"><ahref="exception_ptr.html">exception_ptr</a></span></tt> that refers to an instance of <tt><spanclass="RenoLink"><ahref="unknown_exception.html">unknown_exception</a></span></tt>. In this case, if the original exception object derives from <tt>boost::<spanclass="RenoLink"><ahref="exception.html">exception</a></span></tt>, then the <tt>boost::<spanclass="RenoLink"><ahref="exception.html">exception</a></span></tt> sub-object of the <tt><spanclass="RenoLink"><ahref="unknown_exception.html">unknown_exception</a></span></tt> object is initialized by the <tt>boost::<spanclass="RenoLink"><ahref="exception.html">exception</a></span></tt> copy constructor.</li>