Remove a couple of bugs, clarify a couple of minor points; from Kevlin

[SVN r14148]
This commit is contained in:
Beman Dawes
2002-06-15 21:13:12 +00:00
parent 23e5f7cca3
commit 0ec92f1f03

View File

@@ -79,8 +79,13 @@ convenience for such conversions. For more involved conversions, such as where
precision or formatting need tighter control than is offered by the default
behavior of <code>lexical_cast</code>, the conventional
<code>stringstream</code> approach is recommended. Where the conversions are
numeric to numeric, <code><a href="cast.htm#numeric_cast">numeric_cast</a></code> may offer more reasonable
behavior than <code>lexical_cast</code>.
numeric to numeric, <code><a href="cast.htm#numeric_cast">numeric_cast</a></code>
may offer more reasonable behavior than <code>lexical_cast</code>.
<p>
For a good discussion of the options and issues involved in string-based formatting,
including comparison of <code>stringstream</code>, <code>lexical_cast</code>, and
others, see Herb Sutter's article, <a href="http://www.gotw.ca/publications/mill19.htm">
<i>The String Formatters of Manor Farm</i></a>.
<p>
<hr>
@@ -154,12 +159,8 @@ template&lt;typename Target, typename Source&gt;
</blockquote>
Returns the result of streaming <code>arg</code> into a <code>std::stringstream</code> and then
out as a <code>Target</code> object. The conversion is parameterized by the current
<a href="#lexical_context"><code>lexical_context</code></a>, if set. If the conversion is
unsuccessful, a <a href="#bad_lexical_cast"><code>bad_lexical_cast</code></a> exception is thrown
if the current <a href="#lexical_context"><code>lexical_context</code></a> is set for throwing or
if there is no current <a href="#lexical_context"><code>lexical_context</code></a> set, otherwise a
<code>Target()</code> is returned.
out as a <code>Target</code> object. If the conversion is unsuccessful, a
<a href="#bad_lexical_cast"><code>bad_lexical_cast</code></a> exception is thrown.
<p>
The requirements on the argument and result types are:
<ul>
@@ -220,23 +221,32 @@ preference to the standard <code>&lt;sstream&gt;</code> header for out-of-the-bo
<ul>
<li>
A mechanism for providing quality-of-service control is needed, e.g. formatting and exception
behavior. In the name of simplicity (and release), the current version strips out an earlier
experimental version.
Improved string handling, correctly accommodating wide character strings, incompatible
<code>basic_string</code> types, and empty strings.
</li>
<li>
Wide character and incompatible <code>std::basic_string</code> issues need to be catered for.
Optimize the use of a stream away for identity conversions.
</li>
<li>
An <code>interpret_cast</code> that performs a <i>do-something-reasonable</i> conversion between
types. It would, for instance, select between <code>numeric_cast</code> and <code>lexical_cast</code>
based on <code>std::numeric_limits<>::is_specialized</code>.
based on <code>std::numeric_limits&lt;&gt;::is_specialized</code>. This would be an interesting
project, but there are no concrete plans to pursue this at the moment.
</li>
<li>
It is also worth mentioning future <i>non-directions</i>: anything that involves adding extra
arguments for a conversion operation is not being considered. A custom keyword cast, such as
<code>lexical_cast</code>, is intended to look like a built-in cast operator: built-in cast operators
take only a single operand. Where a higher degree of control is required over conversions, the
standard <code>stringstream</code> offers a more appropriate path. Where non-stream-based conversions
are required, <code>lexical_cast</code> is the wrong tool for the job, and so it won't be special-cased
for such scenarios.
</li>
</ul>
<hr>
<div align="right"><small><i>&copy; Copyright Kevlin Henney, 2000</i></small></div>
<div align="right"><small><i>&copy; Copyright Kevlin Henney, 2000, 2002</i></small></div>
</body>
</html>