forked from boostorg/exception
documentation update
[SVN r52096]
This commit is contained in:
@ -22,7 +22,7 @@
|
||||
<div class="RenoIncludeDIV"><div class="RenoAutoDIV"><h3>Exception Types As Simple Semantic Tags</h3>
|
||||
</div>
|
||||
<p>Deriving from boost::<span class="RenoLink"><a href="exception.html">exception</a></span> effectively decouples the semantics of a failure from the information that is relevant to each individual instance of reporting a failure with a given semantic.</p>
|
||||
<p>In other words: with boost::<span class="RenoLink"><a href="exception.html">exception</a></span>, what data a given exception object transports depends primarily on the context in which failures are reported (not on its type). Since exception types need no members, it becomes very natural to throw exceptions that derive from more than one type to indicate multiple appropriate semantics:</p>
|
||||
<p>In other words: with boost::<span class="RenoLink"><a href="exception.html">exception</a></span>, what data a given exception object transports depends primarily on the context in which failures are reported (not on its type.) Since exception types need no members, it becomes very natural to throw exceptions that derive from more than one type to indicate multiple appropriate semantics:</p>
|
||||
<pre>struct exception_base: virtual std::exception, virtual boost::<span class="RenoLink"><a href="exception.html">exception</a></span> { };
|
||||
struct io_error: virtual exception_base { };
|
||||
struct file_error: virtual io_error { };
|
||||
|
@ -72,7 +72,8 @@ read_file( FILE * f, char const * name )
|
||||
</ul></div>
|
||||
<p>For example, in the throw statement below we only add the errno code, since this is the only failure-relevant information available in this context:</p>
|
||||
<pre>struct exception_base: virtual std::exception, virtual boost::<span class="RenoLink"><a href="exception.html">exception</a></span> { };
|
||||
struct file_read_error: virtual exception_base { };
|
||||
struct io_error: virtual exception_base { };
|
||||
struct file_read_error: virtual io_error { };
|
||||
|
||||
typedef boost::<span class="RenoLink"><a href="error_info.html">error_info</a></span><struct tag_errno_code,int> errno_code;
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user