mirror of
https://github.com/boostorg/convert.git
synced 2026-01-31 08:02:18 +00:00
138 lines
8.9 KiB
HTML
138 lines
8.9 KiB
HTML
<html>
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
|
<title>Chapter 1. The Boost Convert Library 2.0</title>
|
|
<link rel="stylesheet" href="boostbook.css" type="text/css">
|
|
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
|
<link rel="home" href="index.html" title="Chapter 1. The Boost Convert Library 2.0">
|
|
<link rel="next" href="the_boost_convert_library/introduction.html" title="Introduction">
|
|
</head>
|
|
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
|
<div class="spirit-nav"><a accesskey="n" href="the_boost_convert_library/introduction.html"><img src="images/next.png" alt="Next"></a></div>
|
|
<div class="chapter">
|
|
<div class="titlepage"><div>
|
|
<div><h2 class="title">
|
|
<a name="convert"></a>Chapter 1. The Boost Convert Library 2.0</h2></div>
|
|
<div><div class="author"><h3 class="author">
|
|
<span class="firstname">Vladimir</span> <span class="surname">Batov</span>
|
|
</h3></div></div>
|
|
<div><p class="copyright">Copyright © 2009-2014 Vladimir Batov</p></div>
|
|
<div><div class="legalnotice">
|
|
<a name="convert.legal"></a><p>
|
|
Distributed under the Boost Software License, Version 1.0. See 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#the_boost_convert_library.rationale">Rationale</a></span></dt>
|
|
<dt><span class="section"><a href="the_boost_convert_library/introduction.html">Introduction</a></span></dt>
|
|
<dt><span class="section"><a href="the_boost_convert_library/getting_started.html">Getting Started</a></span></dt>
|
|
<dt><span class="section"><a href="the_boost_convert_library/getting_serious.html">Getting Serious</a></span></dt>
|
|
<dt><span class="section"><a href="the_boost_convert_library/boost_convert_with_standard_algorithms.html">Boost.Convert
|
|
with Standard Algorithms</a></span></dt>
|
|
<dt><span class="section"><a href="the_boost_convert_library/converters.html">Converters</a></span></dt>
|
|
<dt><span class="section"><a href="the_boost_convert_library/boost__lexical_cast_based_converter.html">boost::lexical_cast-Based
|
|
Converter</a></span></dt>
|
|
<dt><span class="section"><a href="the_boost_convert_library/std__stringstream_based_converter.html">std::stringstream-Based
|
|
Converter</a></span></dt>
|
|
<dd><dl>
|
|
<dt><span class="section"><a href="the_boost_convert_library/std__stringstream_based_converter.html#the_boost_convert_library.std__stringstream_based_converter.formatting_support">Formatting
|
|
Support</a></span></dt>
|
|
<dt><span class="section"><a href="the_boost_convert_library/std__stringstream_based_converter/locale_support.html">Locale
|
|
Support</a></span></dt>
|
|
<dt><span class="section"><a href="the_boost_convert_library/std__stringstream_based_converter/integration_of_user_defined_types.html">Integration
|
|
of User-Defined Types</a></span></dt>
|
|
</dl></dd>
|
|
<dt><span class="section"><a href="the_boost_convert_library/type_requirements.html">Type Requirements</a></span></dt>
|
|
<dt><span class="section"><a href="the_boost_convert_library/the___default_constructible__type_requirement.html">The
|
|
<span class="emphasis"><em>Default Constructible</em></span> Type Requirement</a></span></dt>
|
|
<dt><span class="section"><a href="the_boost_convert_library/performance.html">Performance</a></span></dt>
|
|
<dt><span class="section"><a href="the_boost_convert_library/other_conversions.html">Other Conversions</a></span></dt>
|
|
<dt><span class="section"><a href="the_boost_convert_library/acknowledgements.html">Acknowledgements</a></span></dt>
|
|
<dt><span class="section"><a href="the_boost_convert_library/references.html">References</a></span></dt>
|
|
<dt><span class="section"><a href="convert_reference.html">Convert Reference</a></span></dt>
|
|
<dd><dl>
|
|
<dt><span class="section"><a href="convert_reference.html#header.boost.convert.api_hpp">Header <boost/convert/api.hpp></a></span></dt>
|
|
<dt><span class="section"><a href="header/boost/convert/forward_hpp.html">Header <boost/convert/forward.hpp></a></span></dt>
|
|
<dt><span class="section"><a href="header/boost/convert/parameters_hpp.html">Header <boost/convert/parameters.hpp></a></span></dt>
|
|
<dd><dl></dl></dd>
|
|
<dt><span class="section"><a href="header/boost/convert/result_hpp.html">Header <boost/convert/result.hpp></a></span></dt>
|
|
<dd><dl></dl></dd>
|
|
</dl></dd>
|
|
<dt><span class="section"><a href="index/s16.html">Index</a></span></dt>
|
|
</dl>
|
|
</div>
|
|
<div class="note"><table border="0" summary="Note">
|
|
<tr>
|
|
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="images/note.png"></td>
|
|
<th align="left">Note</th>
|
|
</tr>
|
|
<tr><td align="left" valign="top"><p>
|
|
The described framework is not part of the <span class="emphasis"><em>Boost</em></span> library
|
|
collection even though in this document it is referred to as <span class="emphasis"><em>Boost.Convert</em></span>.
|
|
This is done in preparation for potential submission of the library to <span class="emphasis"><em>Boost</em></span>.
|
|
</p></td></tr>
|
|
</table></div>
|
|
<div class="section">
|
|
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
|
|
<a name="the_boost_convert_library.rationale"></a><a class="link" href="index.html#the_boost_convert_library.rationale" title="Rationale">Rationale</a>
|
|
</h2></div></div></div>
|
|
<p>
|
|
I have been using textual configuration files extensively, also processing
|
|
and preparing considerable amounts of data in XML. Consequently, I had a need
|
|
for a library that would provide a <span class="emphasis"><em>uniform and extendible</em></span>
|
|
interface to convert various data between their internal binary representations
|
|
and external (predominantly textual) representations.
|
|
</p>
|
|
<p>
|
|
The <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">lexical_cast</span></code> library (with its orthogonal
|
|
and extendible design) looked very promising and was by far the preferred candidate
|
|
compared to others (such as C functions, the <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">stringstream</span></code>
|
|
API, etc., see <a class="link" href="the_boost_convert_library/references.html#2">[2]</a> for the discussion of alternatives).
|
|
</p>
|
|
<p>
|
|
Unfortunately,
|
|
</p>
|
|
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
|
|
<li class="listitem">
|
|
many deployed user types simply did not meet <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">lexical_cast</span></code>
|
|
requirements (namely, <span class="emphasis"><em>Default Constructibility</em></span>);
|
|
</li>
|
|
<li class="listitem">
|
|
a failure to read and to convert a user-provided configuration parameter
|
|
was not that rare or exceptional to justify the hassle and the overhead
|
|
of exception processing;
|
|
</li>
|
|
<li class="listitem">
|
|
additional flexibility (<span class="emphasis"><em>if</em></span>, <span class="emphasis"><em>when</em></span>
|
|
and <span class="emphasis"><em>how</em></span> to handle) conversion failures was needed;
|
|
</li>
|
|
<li class="listitem">
|
|
additional conversion-related functionality (formatting and locale support)
|
|
were needed.
|
|
</li>
|
|
</ul></div>
|
|
<p>
|
|
The original hope was to see <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">lexical_cast</span></code>
|
|
extended to be applicable to a wider range of use-cases. However, after discussions
|
|
with Kevlin Henney (the <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">lexical_cast</span></code>
|
|
author) and in the Boost Developers forum it was collectively decided that
|
|
the requested extensions were not compatible with the original design and the
|
|
idea of what <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">lexical_cast</span></code> embodied and, therefore, a new
|
|
component with richer interface and functionality was needed. That decision
|
|
resulted in the development and the subsequent submission of the <span class="emphasis"><em>Boost.Convert</em></span>
|
|
library described in this document.
|
|
</p>
|
|
</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: May 20, 2014 at 23:11:49 GMT</small></p></td>
|
|
<td align="right"><div class="copyright-footer"></div></td>
|
|
</tr></table>
|
|
<hr>
|
|
<div class="spirit-nav"><a accesskey="n" href="the_boost_convert_library/introduction.html"><img src="images/next.png" alt="Next"></a></div>
|
|
</body>
|
|
</html>
|