blob: 9212a64310713583fe71c70e8def55cc3a7999dc [file] [log] [blame]
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>Class type_info_wrapper</title>
<link rel="stylesheet" href="../../../../../../doc/src/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
<link rel="home" href="../../index.html" title="Chapter&#160;1.&#160;Boost.Log v2">
<link rel="up" href="../../utilities.html#header.boost.log.utility.type_info_wrapper_hpp" title="Header &lt;boost/log/utility/type_info_wrapper.hpp&gt;">
<link rel="prev" href="type_dispatcher/callback.html" title="Class template callback">
<link rel="next" href="operator___idp47070144.html" title="Function operator!=">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td></tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="type_dispatcher/callback.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../utilities.html#header.boost.log.utility.type_info_wrapper_hpp"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="operator___idp47070144.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
<div class="refentry">
<a name="boost.log.type_info_wrapper"></a><div class="titlepage"></div>
<div class="refnamediv">
<h2><span class="refentrytitle">Class type_info_wrapper</span></h2>
<p>boost::log::type_info_wrapper &#8212; A simple <code class="computeroutput">std::type_info</code> wrapper that implements value semantic for type information objects. </p>
</div>
<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: &lt;<a class="link" href="../../utilities.html#header.boost.log.utility.type_info_wrapper_hpp" title="Header &lt;boost/log/utility/type_info_wrapper.hpp&gt;">boost/log/utility/type_info_wrapper.hpp</a>&gt;
</span>
<span class="keyword">class</span> <a class="link" href="type_info_wrapper.html" title="Class type_info_wrapper">type_info_wrapper</a> <span class="special">{</span>
<span class="keyword">public</span><span class="special">:</span>
<span class="comment">// <a class="link" href="type_info_wrapper.html#boost.log.type_info_wrapperconstruct-copy-destruct">construct/copy/destruct</a></span>
<a class="link" href="type_info_wrapper.html#idp47061536-bb"><span class="identifier">type_info_wrapper</span></a><span class="special">(</span><span class="special">)</span> <span class="keyword">noexcept</span><span class="special">;</span>
<a class="link" href="type_info_wrapper.html#idp47063504-bb"><span class="identifier">type_info_wrapper</span></a><span class="special">(</span><a class="link" href="type_info_wrapper.html" title="Class type_info_wrapper">type_info_wrapper</a> <span class="keyword">const</span> <span class="special">&amp;</span><span class="special">)</span> <span class="keyword">noexcept</span><span class="special">;</span>
<a class="link" href="type_info_wrapper.html#idp47066880-bb"><span class="identifier">type_info_wrapper</span></a><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">type_info</span> <span class="keyword">const</span> <span class="special">&amp;</span><span class="special">)</span> <span class="keyword">noexcept</span><span class="special">;</span>
<span class="comment">// <a class="link" href="type_info_wrapper.html#idp47034656-bb">public member functions</a></span>
<span class="keyword">explicit</span> <a class="link" href="type_info_wrapper.html#idp47035216-bb"><span class="keyword">operator</span> <span class="keyword">bool</span></a><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span> <span class="keyword">noexcept</span><span class="special">;</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">type_info</span> <span class="keyword">const</span> <span class="special">&amp;</span> <a class="link" href="type_info_wrapper.html#idp47038272-bb"><span class="identifier">get</span></a><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span> <span class="keyword">noexcept</span><span class="special">;</span>
<span class="keyword">void</span> <a class="link" href="type_info_wrapper.html#idp47041248-bb"><span class="identifier">swap</span></a><span class="special">(</span><a class="link" href="type_info_wrapper.html" title="Class type_info_wrapper">type_info_wrapper</a> <span class="special">&amp;</span><span class="special">)</span> <span class="keyword">noexcept</span><span class="special">;</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span> <a class="link" href="type_info_wrapper.html#idp47043776-bb"><span class="identifier">pretty_name</span></a><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
<span class="keyword">bool</span> <a class="link" href="type_info_wrapper.html#idp47047088-bb"><span class="keyword">operator</span><span class="special">!</span></a><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span> <span class="keyword">noexcept</span><span class="special">;</span>
<span class="keyword">bool</span> <a class="link" href="type_info_wrapper.html#idp47049872-bb"><span class="keyword">operator</span><span class="special">==</span></a><span class="special">(</span><a class="link" href="type_info_wrapper.html" title="Class type_info_wrapper">type_info_wrapper</a> <span class="keyword">const</span> <span class="special">&amp;</span><span class="special">)</span> <span class="keyword">const</span> <span class="keyword">noexcept</span><span class="special">;</span>
<span class="keyword">bool</span> <a class="link" href="type_info_wrapper.html#idp47055488-bb"><span class="keyword">operator</span><span class="special">&lt;</span></a><span class="special">(</span><a class="link" href="type_info_wrapper.html" title="Class type_info_wrapper">type_info_wrapper</a> <span class="keyword">const</span> <span class="special">&amp;</span><span class="special">)</span> <span class="keyword">const</span> <span class="keyword">noexcept</span><span class="special">;</span>
<span class="special">}</span><span class="special">;</span></pre></div>
<div class="refsect1">
<a name="idp136864736"></a><h2>Description</h2>
<p>The type info wrapper is very useful for storing type information objects in containers, as a key or value. It also provides a number of useful features, such as default construction and assignment support, an empty state and extended support for human-friendly type names. </p>
<div class="refsect2">
<a name="idp136865696"></a><h3>
<a name="boost.log.type_info_wrapperconstruct-copy-destruct"></a><code class="computeroutput">type_info_wrapper</code>
public
construct/copy/destruct</h3>
<div class="orderedlist"><ol class="orderedlist" type="1">
<li class="listitem">
<pre class="literallayout"><a name="idp47061536-bb"></a><span class="identifier">type_info_wrapper</span><span class="special">(</span><span class="special">)</span> <span class="keyword">noexcept</span><span class="special">;</span></pre>
<p>Default constructor</p>
<p>
</p>
<div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody><tr>
<td><p><span class="term">Postconditions:</span></p></td>
<td><p><code class="computeroutput">!*this == true</code> </p></td>
</tr></tbody>
</table></div>
</li>
<li class="listitem">
<pre class="literallayout"><a name="idp47063504-bb"></a><span class="identifier">type_info_wrapper</span><span class="special">(</span><a class="link" href="type_info_wrapper.html" title="Class type_info_wrapper">type_info_wrapper</a> <span class="keyword">const</span> <span class="special">&amp;</span> that<span class="special">)</span> <span class="keyword">noexcept</span><span class="special">;</span></pre>
<p>Copy constructor</p>
<p>
</p>
<div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term">Parameters:</span></p></td>
<td><div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody><tr>
<td><p><span class="term"><code class="computeroutput">that</code></span></p></td>
<td><p>Source type info wrapper to copy from </p></td>
</tr></tbody>
</table></div></td>
</tr>
<tr>
<td><p><span class="term">Postconditions:</span></p></td>
<td><p><code class="computeroutput">*this == that</code> </p></td>
</tr>
</tbody>
</table></div>
</li>
<li class="listitem">
<pre class="literallayout"><a name="idp47066880-bb"></a><span class="identifier">type_info_wrapper</span><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">type_info</span> <span class="keyword">const</span> <span class="special">&amp;</span> that<span class="special">)</span> <span class="keyword">noexcept</span><span class="special">;</span></pre>
<p>Conversion constructor</p>
<p>
</p>
<div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term">Parameters:</span></p></td>
<td><div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody><tr>
<td><p><span class="term"><code class="computeroutput">that</code></span></p></td>
<td><p>Type info object to be wrapped </p></td>
</tr></tbody>
</table></div></td>
</tr>
<tr>
<td><p><span class="term">Postconditions:</span></p></td>
<td><p><code class="computeroutput">*this == that &amp;&amp; !!*this</code> </p></td>
</tr>
</tbody>
</table></div>
</li>
</ol></div>
</div>
<div class="refsect2">
<a name="idp136898400"></a><h3>
<a name="idp47034656-bb"></a><code class="computeroutput">type_info_wrapper</code> public member functions</h3>
<div class="orderedlist"><ol class="orderedlist" type="1">
<li class="listitem">
<pre class="literallayout"><span class="keyword">explicit</span> <a name="idp47035216-bb"></a><span class="keyword">operator</span> <span class="keyword">bool</span><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span> <span class="keyword">noexcept</span><span class="special">;</span></pre>
<p>
</p>
<div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody><tr>
<td><p><span class="term">Returns:</span></p></td>
<td><p><code class="computeroutput">true</code> if the type info wrapper was initialized with a particular type, <code class="computeroutput">false</code> if the wrapper was default-constructed and not yet initialized </p></td>
</tr></tbody>
</table></div>
</li>
<li class="listitem">
<pre class="literallayout"><span class="identifier">std</span><span class="special">::</span><span class="identifier">type_info</span> <span class="keyword">const</span> <span class="special">&amp;</span> <a name="idp47038272-bb"></a><span class="identifier">get</span><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span> <span class="keyword">noexcept</span><span class="special">;</span></pre>
<p>Stored type info getter</p>
<p>
</p>
<div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term">Requires:</span></p></td>
<td><p><code class="computeroutput">!!*this</code> </p></td>
</tr>
<tr>
<td><p><span class="term">Returns:</span></p></td>
<td><p>Constant reference to the wrapped type info object </p></td>
</tr>
</tbody>
</table></div>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">void</span> <a name="idp47041248-bb"></a><span class="identifier">swap</span><span class="special">(</span><a class="link" href="type_info_wrapper.html" title="Class type_info_wrapper">type_info_wrapper</a> <span class="special">&amp;</span> that<span class="special">)</span> <span class="keyword">noexcept</span><span class="special">;</span></pre>
<p>Swaps two instances of the wrapper </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span> <a name="idp47043776-bb"></a><span class="identifier">pretty_name</span><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre>
<p>The method returns the contained type name string in a possibly more readable format than <code class="computeroutput">get().name()</code></p>
<p>
</p>
<div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term">Requires:</span></p></td>
<td><p><code class="computeroutput">!!*this</code> </p></td>
</tr>
<tr>
<td><p><span class="term">Returns:</span></p></td>
<td><p>Type name string </p></td>
</tr>
</tbody>
</table></div>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">bool</span> <a name="idp47047088-bb"></a><span class="keyword">operator</span><span class="special">!</span><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span> <span class="keyword">noexcept</span><span class="special">;</span></pre>
<p>
</p>
<div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody><tr>
<td><p><span class="term">Returns:</span></p></td>
<td><p><code class="computeroutput">false</code> if the type info wrapper was initialized with a particular type, <code class="computeroutput">true</code> if the wrapper was default-constructed and not yet initialized </p></td>
</tr></tbody>
</table></div>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">bool</span> <a name="idp47049872-bb"></a><span class="keyword">operator</span><span class="special">==</span><span class="special">(</span><a class="link" href="type_info_wrapper.html" title="Class type_info_wrapper">type_info_wrapper</a> <span class="keyword">const</span> <span class="special">&amp;</span> that<span class="special">)</span> <span class="keyword">const</span> <span class="keyword">noexcept</span><span class="special">;</span></pre>
<p>Equality comparison</p>
<p>
</p>
<div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term">Parameters:</span></p></td>
<td><div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody><tr>
<td><p><span class="term"><code class="computeroutput">that</code></span></p></td>
<td><p>Comparand </p></td>
</tr></tbody>
</table></div></td>
</tr>
<tr>
<td><p><span class="term">Returns:</span></p></td>
<td><p>If either this object or comparand is in empty state and the other is not, the result is <code class="computeroutput">false</code>. If both arguments are empty, the result is <code class="computeroutput">true</code>. If both arguments are not empty, the result is <code class="computeroutput">true</code> if this object wraps the same type as the comparand and <code class="computeroutput">false</code> otherwise. </p></td>
</tr>
</tbody>
</table></div>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">bool</span> <a name="idp47055488-bb"></a><span class="keyword">operator</span><span class="special">&lt;</span><span class="special">(</span><a class="link" href="type_info_wrapper.html" title="Class type_info_wrapper">type_info_wrapper</a> <span class="keyword">const</span> <span class="special">&amp;</span> that<span class="special">)</span> <span class="keyword">const</span> <span class="keyword">noexcept</span><span class="special">;</span></pre>
<p>Ordering operator</p>
<p>
</p>
<div class="note"><table border="0" summary="Note">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../../../../../../doc/src/images/note.png"></td>
<th align="left">Note</th>
</tr>
<tr><td align="left" valign="top"><p>The results of this operator are only consistent within a single run of application. The result may change for the same types after rebuilding or even restarting the application. </p></td></tr>
</table></div>
<p>
</p>
<div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term">Parameters:</span></p></td>
<td><div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody><tr>
<td><p><span class="term"><code class="computeroutput">that</code></span></p></td>
<td><p>Comparand </p></td>
</tr></tbody>
</table></div></td>
</tr>
<tr>
<td><p><span class="term">Requires:</span></p></td>
<td><p><code class="computeroutput">!!*this &amp;&amp; !!that</code> </p></td>
</tr>
<tr>
<td><p><span class="term">Returns:</span></p></td>
<td><p><code class="computeroutput">true</code> if this object wraps type info object that is ordered before the type info object in the comparand, <code class="computeroutput">false</code> otherwise </p></td>
</tr>
</tbody>
</table></div>
</li>
</ol></div>
</div>
</div>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright &#169; 2007-2015 Andrey
Semashev<p>
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>).
</p>
</div></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="type_dispatcher/callback.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../utilities.html#header.boost.log.utility.type_info_wrapper_hpp"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="operator___idp47070144.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
</body>
</html>