forked from boostorg/exception
Documentation update
[SVN r52122]
This commit is contained in:
@ -68,6 +68,7 @@
|
||||
</li>
|
||||
</ol></div>
|
||||
</li>
|
||||
<li><span class="RenoLink"><a href="frequently_asked_questions.html">Frequently Asked Questions</a></span></li>
|
||||
<li><span class="RenoLink"><a href="name_idx.html">Index</a></span></li>
|
||||
</ol></div>
|
||||
<h2>Synopsis</h2>
|
||||
@ -205,12 +206,24 @@ boost
|
||||
<p>T must have accessible copy constructor and must not be a reference (there is no requirement that T's copy constructor does not throw.)</p>
|
||||
<h4>Description:</h4>
|
||||
<p>This class template is used to associate a Tag type with a value type T. Objects of type <span class="RenoLink"><a href="error_info.html">error_info</a></span><Tag,T> can be passed to <span class="RenoLink"><a href="exception_operator_shl.html">operator<<</a></span> to be stored in objects of type boost::<span class="RenoLink"><a href="exception.html">exception</a></span>.</p>
|
||||
<h4>Note:</h4>
|
||||
<p>The header <<span class="RenoLink"><a href="exception_error_info_value_hpp.html">boost/exception/error_info.hpp</a></span>> provides a declaration of the <span class="RenoLink"><a href="error_info.html">error_info</a></span> template, which is sufficient for the purpose of typedefing an instance for specific Tag and T, like this:</p>
|
||||
<h4>Usage:</h4>
|
||||
<p>The header <<span class="RenoLink"><a href="exception_error_info_value_hpp.html">boost/exception/error_info.hpp</a></span>> provides a declaration of the <span class="RenoLink"><a href="error_info.html">error_info</a></span> template, which is sufficient for the purpose of typedefing an instance for specific Tag and T, for example:</p>
|
||||
<pre>#include <<span class="RenoLink"><a href="exception_error_info_value_hpp.html">boost/exception/error_info.hpp</a></span>>
|
||||
|
||||
struct tag_errno;
|
||||
typedef boost::<span class="RenoLink"><a href="error_info.html">error_info</a></span><tag_errno,int> errno_info;</pre>
|
||||
<p>Or, the shorter equivalent:</p>
|
||||
<pre>#include <<span class="RenoLink"><a href="exception_error_info_value_hpp.html">boost/exception/error_info.hpp</a></span>>
|
||||
|
||||
typedef boost::<span class="RenoLink"><a href="error_info.html">error_info</a></span><struct tag_errno,int> errno_info;</pre>
|
||||
<p>Of course, to actually add an <span class="RenoLink"><a href="error_info.html">error_info</a></span> object to <span class="RenoLink"><a href="exception.html">exceptions</a></span> using <span class="RenoLink"><a href="exception_operator_shl.html">operator<<</a></span>, or to retrieve it using <span class="RenoLink"><a href="get_error_info.html">get_error_info</a></span>, you must first #include <<span class="RenoLink"><a href="exception_error_info_hpp.html">boost/exception/info.hpp</a></span>>.</p>
|
||||
<p>This errno_info typedef can be passed to <span class="RenoLink"><a href="exception_operator_shl.html">operator<<</a></span> (#include <<span class="RenoLink"><a href="exception_error_info_hpp.html">boost/exception/info.hpp</a></span>> first) to store an int named tag_errno in exceptions of types that derive from boost::<span class="RenoLink"><a href="exception.html">exception</a></span>:</p>
|
||||
<pre>throw file_read_error() <span class="RenoLink"><a href="exception_operator_shl.html"><<</a></span> errno_info(errno);</pre>
|
||||
<p>It can also be passed to <span class="RenoLink"><a href="get_error_info.html">get_error_info</a></span> (#include <<span class="RenoLink"><a href="exception_get_error_info_hpp.html">boost/exception/get_error_info.hpp</a></span>> first) to retrieve the tag_errno int from a boost::<span class="RenoLink"><a href="exception.html">exception</a></span>:</p>
|
||||
<pre>catch( boost::<span class="RenoLink"><a href="exception.html">exception</a></span> & x )
|
||||
{
|
||||
if( boost::shared_ptr<int const> e=boost::<span class="RenoLink"><a href="get_error_info.html">get_error_info</a></span><errno_info>(x) )
|
||||
....
|
||||
}</pre>
|
||||
</div><div class="RenoIncludeDIV"><div class="RenoAutoDIV"><h3>exception/operator<<</h3>
|
||||
</div>
|
||||
<div class="RenoIncludeDIV"><p><span class="RenoEscape">#<!--<wiki>`#</wiki>--></span>include <<span class="RenoLink"><a href="exception_error_info_hpp.html">boost/exception/info.hpp</a></span>><span class="RenoBR"> </span><br/></p>
|
||||
|
Reference in New Issue
Block a user