1<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 2<html> 3<head> 4<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 5<title>Chapter 11. The Conversion Library 1.7</title> 6<link rel="stylesheet" href="../../doc/src/boostbook.css" type="text/css"> 7<meta name="generator" content="DocBook XSL Stylesheets V1.79.1"> 8<link rel="home" href="index.html" title="The Boost C++ Libraries BoostBook Documentation Subset"> 9<link rel="up" href="libraries.html" title="Part I. The Boost C++ Libraries (BoostBook Subset)"> 10<link rel="prev" href="hash/acknowledgements.html" title="Acknowledgements"> 11<link rel="next" href="conversion/polymorphic_casts.html" title="Polymorphic casts"> 12</head> 13<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> 14<table cellpadding="2" width="100%"><tr> 15<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../boost.png"></td> 16<td align="center"><a href="../../index.html">Home</a></td> 17<td align="center"><a href="../../libs/libraries.htm">Libraries</a></td> 18<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td> 19<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td> 20<td align="center"><a href="../../more/index.htm">More</a></td> 21</tr></table> 22<hr> 23<div class="spirit-nav"> 24<a accesskey="p" href="hash/acknowledgements.html"><img src="../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="libraries.html"><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="conversion/polymorphic_casts.html"><img src="../../doc/src/images/next.png" alt="Next"></a> 25</div> 26<div class="chapter"> 27<div class="titlepage"><div> 28<div><h2 class="title"> 29<a name="conversion"></a>Chapter 11. The Conversion Library 1.7</h2></div> 30<div><div class="authorgroup"> 31<div class="author"><h3 class="author"> 32<span class="firstname">Bjarne</span> <span class="surname">Stroustrup</span> 33</h3></div> 34<div class="author"><h3 class="author"> 35<span class="firstname">Dave</span> <span class="surname">Abrahams</span> 36</h3></div> 37<div class="author"><h3 class="author"> 38<span class="firstname">Boris</span> <span class="surname">Rasin</span> 39</h3></div> 40<div class="author"><h3 class="author"> 41<span class="firstname">Antony</span> <span class="surname">Polukhin</span> 42</h3></div> 43</div></div> 44<div><p class="copyright">Copyright © 2001 Beman Dawes</p></div> 45<div><p class="copyright">Copyright © 2014-2020 Antony Polukhin</p></div> 46<div><div class="legalnotice"> 47<a name="conversion.legal"></a><p> 48 Distributed under the Boost Software License, Version 1.0. (See accompanying 49 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>) 50 </p> 51</div></div> 52</div></div> 53<div class="toc"> 54<p><b>Table of Contents</b></p> 55<dl class="toc"> 56<dt><span class="section"><a href="conversion.html#conversion.description">Description</a></span></dt> 57<dt><span class="section"><a href="conversion/polymorphic_casts.html">Polymorphic casts</a></span></dt> 58<dd><dl> 59<dt><span class="section"><a href="conversion/polymorphic_casts.html#conversion.polymorphic_casts.polymorphic_downcast">polymorphic_downcast</a></span></dt> 60<dt><span class="section"><a href="conversion/polymorphic_casts.html#conversion.polymorphic_casts.polymorphic_cast">polymorphic_cast</a></span></dt> 61<dt><span class="section"><a href="conversion/polymorphic_casts.html#conversion.polymorphic_casts.polymorphic_pointer_cast">polymorphic_pointer_cast</a></span></dt> 62</dl></dd> 63<dt><span class="section"><a href="conversion/synopsis.html">Synopsis</a></span></dt> 64<dt><span class="section"><a href="conversion/history.html">History</a></span></dt> 65</dl> 66</div> 67<div class="section"> 68<div class="titlepage"><div><div><h2 class="title" style="clear: both"> 69<a name="conversion.description"></a><a class="link" href="conversion.html#conversion.description" title="Description">Description</a> 70</h2></div></div></div> 71<p> 72 The Conversion Library improves program safety and clarity by performing otherwise 73 messy conversions. It includes cast-style function templates designed to complement 74 the C++ Standard's built-in casts. 75 </p> 76<p> 77 To reduce coupling, particularly to standard library IOStreams, the Boost Conversion 78 Library is supplied by several headers: 79 </p> 80<div class="orderedlist"><ol class="orderedlist" type="1"> 81<li class="listitem"> 82 The <a href="../../boost/polymorphic_cast.hpp" target="_top">boost/polymorphic_cast.hpp</a> 83 header provides <a class="link" href="conversion/polymorphic_casts.html#polymorphic_cast"><code class="computeroutput"><span class="identifier">polymorphic_cast</span><span class="special"><></span></code></a> and <a class="link" href="conversion/polymorphic_casts.html#polymorphic_downcast"><code class="computeroutput"><span class="identifier">polymorphic_downcast</span><span class="special"><></span></code></a> 84 to perform safe casting between polymorphic types. 85 </li> 86<li class="listitem"> 87 The <a href="../../boost/polymorphic_pointer_cast.hpp" target="_top">boost/polymorphic_pointer_cast.hpp</a> 88 header provides <a class="link" href="conversion/polymorphic_casts.html#polymorphic_pointer_cast"><code class="computeroutput"><span class="identifier">polymorphic_pointer_cast</span><span class="special"><></span></code></a> 89 and <a class="link" href="conversion/polymorphic_casts.html#polymorphic_pointer_cast"><code class="computeroutput"><span class="identifier">polymorphic_pointer_downcast</span><span class="special"><></span></code></a> 90 </li> 91<li class="listitem"> 92 The <a href="../../boost/implicit_cast.hpp" target="_top">boost/implicit_cast.hpp</a> 93 header provides <code class="computeroutput"><span class="identifier">implicit_cast</span><span class="special"><></span></code> to perform implicit casts only 94 (no down-cast, no void*->T*, no U->T if T has only explicit constructors 95 for U). 96 </li> 97<li class="listitem"> 98 The <a href="../../boost/lexical_cast.hpp" target="_top">boost/lexical_cast.hpp</a> 99 header provides <a href="../../libs/lexical_cast/doc/html/index.html" target="_top"><code class="computeroutput"><span class="identifier">lexical_cast</span><span class="special"><></span></code></a> 100 general literal text conversions, such as an <code class="computeroutput"><span class="keyword">int</span></code> 101 represented as a <code class="computeroutput"><span class="identifier">string</span></code>, 102 or vice-versa. 103 </li> 104</ol></div> 105</div> 106</div> 107<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> 108<td align="left"></td> 109<td align="right"><div class="copyright-footer"></div></td> 110</tr></table> 111<hr> 112<div class="spirit-nav"> 113<a accesskey="p" href="hash/acknowledgements.html"><img src="../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="libraries.html"><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="conversion/polymorphic_casts.html"><img src="../../doc/src/images/next.png" alt="Next"></a> 114</div> 115</body> 116</html> 117