forked from boostorg/type_index
113 lines
6.8 KiB
HTML
113 lines
6.8 KiB
HTML
<html>
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
|
<title>Chapter 1. Boost.TypeIndex 1.0</title>
|
|
<link rel="stylesheet" href="http://www.boost.org/doc/libs/1_49_0/doc/src/boostbook.css" type="text/css">
|
|
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
|
<link rel="home" href="index.html" title="Chapter 1. Boost.TypeIndex 1.0">
|
|
<link rel="next" href="boost_typeindex/getting_started.html" title="Getting started">
|
|
</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="http://www.boost.org/doc/libs/1_49_0/boost.png"></td>
|
|
<td align="center"><a href="http://www.boost.org/doc/libs/1_49_0/index.html">Home</a></td>
|
|
<td align="center"><a href="http://www.boost.org/doc/libs/1_49_0/libs/libraries.htm">Libraries</a></td>
|
|
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
|
|
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
|
|
<td align="center"><a href="http://www.boost.org/doc/libs/1_49_0/more/index.htm">More</a></td>
|
|
</tr></table>
|
|
<hr>
|
|
<div class="spirit-nav"><a accesskey="n" href="boost_typeindex/getting_started.html"><img src="http://www.boost.org/doc/libs/1_49_0/doc/src/images/next.png" alt="Next"></a></div>
|
|
<div class="chapter">
|
|
<div class="titlepage"><div>
|
|
<div><h2 class="title">
|
|
<a name="boost_typeindex"></a>Chapter 1. Boost.TypeIndex 1.0</h2></div>
|
|
<div><p class="copyright">Copyright © 2012 Antony Polukhin</p></div>
|
|
<div><div class="legalnotice">
|
|
<a name="boost_typeindex.legal"></a><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></div>
|
|
</div></div>
|
|
<div class="toc">
|
|
<p><b>Table of Contents</b></p>
|
|
<dl>
|
|
<dt><span class="section"><a href="index.html#boost_typeindex.motivation">Motivation</a></span></dt>
|
|
<dt><span class="section"><a href="boost_typeindex/getting_started.html">Getting started</a></span></dt>
|
|
<dt><span class="section"><a href="boost_typeindex/examples.html">Examples</a></span></dt>
|
|
<dt><span class="section"><a href="boost_typeindex_header_reference.html">Boost.TypeIndex Header Reference</a></span></dt>
|
|
<dd><dl><dt><span class="section"><a href="boost_typeindex_header_reference.html#header.boost.type_index_hpp">Header <boost/type_index.hpp></a></span></dt></dl></dd>
|
|
<dt><span class="section"><a href="boost_typeindex/performance.html">Performance</a></span></dt>
|
|
<dt><span class="section"><a href="boost_typeindex/compiler_support.html">Compiler support</a></span></dt>
|
|
</dl>
|
|
</div>
|
|
<div class="section boost_typeindex_motivation">
|
|
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
|
|
<a name="boost_typeindex.motivation"></a><a class="link" href="index.html#boost_typeindex.motivation" title="Motivation">Motivation</a>
|
|
</h2></div></div></div>
|
|
<p>
|
|
Sometimes getting and storing information about a template type at runtime
|
|
is required. For such cases a construction like <code class="computeroutput"><span class="special">&</span><span class="keyword">typeid</span><span class="special">(</span><span class="identifier">T</span><span class="special">)</span></code> or C++11 class <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">type_index</span></code>
|
|
is usually used. And that is the point, where problems start:
|
|
</p>
|
|
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
|
|
<li class="listitem">
|
|
<code class="computeroutput"><span class="keyword">typeid</span><span class="special">(</span><span class="identifier">T</span><span class="special">)</span></code> and
|
|
<code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">type_index</span></code> require Run Time Type Info
|
|
(RTTI)
|
|
</li>
|
|
<li class="listitem">
|
|
some implementations of <code class="computeroutput"><span class="keyword">typeid</span><span class="special">(</span><span class="identifier">T</span><span class="special">)</span></code>
|
|
strip const, volatile and references from type, while others don't
|
|
</li>
|
|
<li class="listitem">
|
|
some compilers have bugs and do not correctly compare <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">type_info</span></code>
|
|
objects across shared libraries
|
|
</li>
|
|
<li class="listitem">
|
|
only a few implementations already provide <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">type_index</span></code>
|
|
</li>
|
|
<li class="listitem">
|
|
no easy way to store type info without stripping const, volatile and references
|
|
</li>
|
|
<li class="listitem">
|
|
no nice and portable way to get human readable type names
|
|
</li>
|
|
</ul></div>
|
|
<p>
|
|
Boost.TypeIndex was designed to work around those issues.
|
|
</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="http://www.boost.org/doc/libs/1_49_0/doc/src/images/note.png"></td>
|
|
<th align="left">Note</th>
|
|
</tr>
|
|
<tr><td align="left" valign="top"><p>
|
|
<code class="computeroutput"><span class="identifier">T</span></code> means type here. Think
|
|
of it as of <code class="computeroutput"><span class="identifier">T</span></code> in <code class="computeroutput"><span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">></span></code>
|
|
</p></td></tr>
|
|
</table></div>
|
|
<div class="warning"><table border="0" summary="Warning">
|
|
<tr>
|
|
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Warning]" src="http://www.boost.org/doc/libs/1_49_0/doc/src/images/warning.png"></td>
|
|
<th align="left">Warning</th>
|
|
</tr>
|
|
<tr><td align="left" valign="top"><p>
|
|
This library is not accepted to Boost, it is currrently waiting for review.
|
|
</p></td></tr>
|
|
</table></div>
|
|
</div>
|
|
</div>
|
|
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
|
<td align="left"><p><small>Last revised: March 04, 2013 at 20:02:24 GMT</small></p></td>
|
|
<td align="right"><div class="copyright-footer"></div></td>
|
|
</tr></table>
|
|
<hr>
|
|
<div class="spirit-nav"><a accesskey="n" href="boost_typeindex/getting_started.html"><img src="http://www.boost.org/doc/libs/1_49_0/doc/src/images/next.png" alt="Next"></a></div>
|
|
</body>
|
|
</html>
|