3 <meta http-equiv=
"Content-Type" content=
"text/html; charset=US-ASCII">
4 <title>Design Rationale
</title>
5 <link rel=
"stylesheet" href=
"../../math.css" type=
"text/css">
6 <meta name=
"generator" content=
"DocBook XSL Stylesheets V1.77.1">
7 <link rel=
"home" href=
"../../index.html" title=
"Math Toolkit 2.5.1">
8 <link rel=
"up" href=
"../fp_facets.html" title=
"Facets for Floating-Point Infinities and NaNs">
9 <link rel=
"prev" href=
"portability.html" title=
"Portability">
10 <link rel=
"next" href=
"../next_float.html" title=
"Floating-Point Representation Distance (ULP), and Finding Adjacent Floating-Point Values">
12 <body bgcolor=
"white" text=
"black" link=
"#0000FF" vlink=
"#840084" alink=
"#0000FF">
13 <table cellpadding=
"2" width=
"100%"><tr>
14 <td valign=
"top"><img alt=
"Boost C++ Libraries" width=
"277" height=
"86" src=
"../../../../../../boost.png"></td>
15 <td align=
"center"><a href=
"../../../../../../index.html">Home
</a></td>
16 <td align=
"center"><a href=
"../../../../../../libs/libraries.htm">Libraries
</a></td>
17 <td align=
"center"><a href=
"http://www.boost.org/users/people.html">People
</a></td>
18 <td align=
"center"><a href=
"http://www.boost.org/users/faq.html">FAQ
</a></td>
19 <td align=
"center"><a href=
"../../../../../../more/index.htm">More
</a></td>
22 <div class=
"spirit-nav">
23 <a accesskey=
"p" href=
"portability.html"><img src=
"../../../../../../doc/src/images/prev.png" alt=
"Prev"></a><a accesskey=
"u" href=
"../fp_facets.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=
"../next_float.html"><img src=
"../../../../../../doc/src/images/next.png" alt=
"Next"></a>
26 <div class=
"titlepage"><div><div><h3 class=
"title">
27 <a name=
"math_toolkit.fp_facets.rationale"></a><a class=
"link" href=
"rationale.html" title=
"Design Rationale">Design Rationale
</a>
28 </h3></div></div></div>
29 <div class=
"itemizedlist"><ul class=
"itemizedlist" style=
"list-style-type: disc; ">
31 The flags are implemented as a const data member of the facet. Facets
32 are reference counted, and locales can share facets. Therefore changing
33 the flags of a facet would have effects that are hard to predict. An
34 alternative design would be to implement the flags using
<code class=
"computeroutput"><span class=
"identifier">std
</span><span class=
"special">::
</span><span class=
"identifier">ios_base
</span><span class=
"special">::
</span><span class=
"identifier">xalloc
</span></code> and
<code class=
"computeroutput"><span class=
"identifier">std
</span><span class=
"special">::
</span><span class=
"identifier">ios_base
</span><span class=
"special">::
</span><span class=
"identifier">iword
</span></code>.
35 Then one could safely modify the flags, and one could define manipulators
36 that do so. However, for that to work with dynamically linked libraries,
37 a
<code class=
"computeroutput"><span class=
"special">.
</span><span class=
"identifier">cpp
</span></code>
38 file would have to be added to the library. It was judged be more desirable
39 to have a header-only library, than to have mutable flags and manipulators.
42 The facet
<code class=
"computeroutput"><span class=
"identifier">nonfinite_num_put
</span></code>
43 throws an exception when the
<code class=
"computeroutput"><span class=
"identifier">trap_infinity
</span></code>
44 or
<code class=
"computeroutput"><span class=
"identifier">trap_nan
</span></code> flag is set
45 and an attempt is made to format infinity or NaN. It would be better
46 if the facet set the
<code class=
"computeroutput"><span class=
"identifier">fail
</span> <span class=
"identifier">bit
</span></code> of the stream. However, facets
47 derived from
<code class=
"computeroutput"><span class=
"identifier">std
</span><span class=
"special">::
</span><span class=
"identifier">num_put
</span></code> do not have access to the stream
52 <table xmlns:
rev=
"http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width=
"100%"><tr>
53 <td align=
"left"></td>
54 <td align=
"right"><div class=
"copyright-footer">Copyright
© 2006-
2010,
2012-
2014 Nikhar Agrawal,
55 Anton Bikineev, Paul A. Bristow, Marco Guazzone, Christopher Kormanyos, Hubert
56 Holin, Bruno Lalande, John Maddock, Jeremy Murphy, Johan R
åde, Gautam Sewani,
57 Benjamin Sobotta, Thijs van den Berg, Daryle Walker and Xiaogang Zhang
<p>
58 Distributed under the Boost Software License, Version
1.0. (See accompanying
59 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>)
64 <div class=
"spirit-nav">
65 <a accesskey=
"p" href=
"portability.html"><img src=
"../../../../../../doc/src/images/prev.png" alt=
"Prev"></a><a accesskey=
"u" href=
"../fp_facets.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=
"../next_float.html"><img src=
"../../../../../../doc/src/images/next.png" alt=
"Next"></a>