]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | <html> |
2 | <head> | |
3 | <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII"> | |
4 | <title>Chapter 1. Boost.NumericConversion</title> | |
5 | <link rel="stylesheet" href="boostbook.css" type="text/css"> | |
6 | <meta name="generator" content="DocBook XSL Stylesheets V1.78.1"> | |
7 | <link rel="home" href="index.html" title="Chapter 1. Boost.NumericConversion"> | |
8 | <link rel="next" href="boost_numericconversion/definitions.html" title="Definitions"> | |
9 | </head> | |
10 | <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> | |
11 | <table cellpadding="2" width="100%"><tr> | |
12 | <td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../boost.png"></td> | |
13 | <td align="center"><a href="../../../../../index.html">Home</a></td> | |
14 | <td align="center"><a href="../../../../../libs/libraries.htm">Libraries</a></td> | |
15 | <td align="center"><a href="http://www.boost.org/users/people.html">People</a></td> | |
16 | <td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td> | |
17 | <td align="center"><a href="../../../../../more/index.htm">More</a></td> | |
18 | </tr></table> | |
19 | <hr> | |
20 | <div class="spirit-nav"><a accesskey="n" href="boost_numericconversion/definitions.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a></div> | |
21 | <div class="chapter"> | |
22 | <div class="titlepage"><div> | |
23 | <div><h2 class="title"> | |
24 | <a name="numeric_conversion"></a>Chapter 1. Boost.NumericConversion</h2></div> | |
25 | <div><div class="author"><h3 class="author"> | |
26 | <span class="firstname">Fernando Luis</span> <span class="surname">Cacciola Carballal</span> | |
27 | </h3></div></div> | |
28 | <div><p class="copyright">Copyright © 2004-2007 Fernando | |
29 | Luis Cacciola Carballal</p></div> | |
30 | <div><div class="legalnotice"> | |
31 | <a name="numeric_conversion.legal"></a><p> | |
32 | Distributed under the Boost Software License, Version 1.0. (See accompanying | |
33 | 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>) | |
34 | </p> | |
35 | </div></div> | |
36 | </div></div> | |
37 | <div class="toc"> | |
38 | <p><b>Table of Contents</b></p> | |
39 | <dl class="toc"> | |
40 | <dt><span class="section"><a href="index.html#numeric_conversion.overview">Overview</a></span></dt> | |
41 | <dt><span class="section"><a href="boost_numericconversion/definitions.html">Definitions</a></span></dt> | |
42 | <dd><dl> | |
43 | <dt><span class="section"><a href="boost_numericconversion/definitions.html#boost_numericconversion.definitions.introduction">Introduction</a></span></dt> | |
44 | <dt><span class="section"><a href="boost_numericconversion/definitions.html#boost_numericconversion.definitions.types_and_values">Types | |
45 | and Values</a></span></dt> | |
46 | <dt><span class="section"><a href="boost_numericconversion/definitions.html#boost_numericconversion.definitions.c___arithmetic_types">C++ | |
47 | Arithmetic Types</a></span></dt> | |
48 | <dt><span class="section"><a href="boost_numericconversion/definitions.html#boost_numericconversion.definitions.numeric_types">Numeric | |
49 | Types</a></span></dt> | |
50 | <dt><span class="section"><a href="boost_numericconversion/definitions.html#boost_numericconversion.definitions.range_and_precision">Range | |
51 | and Precision</a></span></dt> | |
52 | <dt><span class="section"><a href="boost_numericconversion/definitions.html#boost_numericconversion.definitions.exact__correctly_rounded_and_out_of_range_representations">Exact, | |
53 | Correctly Rounded and Out-Of-Range Representations</a></span></dt> | |
54 | <dt><span class="section"><a href="boost_numericconversion/definitions.html#boost_numericconversion.definitions.standard__numeric__conversions">Standard | |
55 | (numeric) Conversions</a></span></dt> | |
56 | <dt><span class="section"><a href="boost_numericconversion/definitions.html#boost_numericconversion.definitions.subranged_conversion_direction__subtype_and_supertype">Subranged | |
57 | Conversion Direction, Subtype and Supertype</a></span></dt> | |
58 | </dl></dd> | |
59 | <dt><span class="section"><a href="boost_numericconversion/converter___function_object.html">converter<> | |
60 | function object</a></span></dt> | |
61 | <dd><dl> | |
62 | <dt><span class="section"><a href="boost_numericconversion/converter___function_object.html#boost_numericconversion.converter___function_object.synopsis">Synopsis</a></span></dt> | |
63 | <dt><span class="section"><a href="boost_numericconversion/converter___function_object.html#boost_numericconversion.converter___function_object.template_parameters">Template | |
64 | parameters</a></span></dt> | |
65 | <dt><span class="section"><a href="boost_numericconversion/converter___function_object.html#boost_numericconversion.converter___function_object.member_functions">Member | |
66 | functions</a></span></dt> | |
67 | <dt><span class="section"><a href="boost_numericconversion/converter___function_object.html#boost_numericconversion.converter___function_object.range_checking_logic">Range | |
68 | Checking Logic</a></span></dt> | |
69 | <dt><span class="section"><a href="boost_numericconversion/converter___function_object.html#boost_numericconversion.converter___function_object.examples">Examples</a></span></dt> | |
70 | </dl></dd> | |
71 | <dt><span class="section"><a href="boost_numericconversion/type_requirements_and_user_defined_types_support.html">Type | |
72 | Requirements and User-defined-types support</a></span></dt> | |
73 | <dd><dl> | |
74 | <dt><span class="section"><a href="boost_numericconversion/type_requirements_and_user_defined_types_support.html#boost_numericconversion.type_requirements_and_user_defined_types_support.type_requirements">Type | |
75 | Requirements</a></span></dt> | |
76 | <dt><span class="section"><a href="boost_numericconversion/type_requirements_and_user_defined_types_support.html#boost_numericconversion.type_requirements_and_user_defined_types_support.udt_s_special_semantics">UDT's | |
77 | special semantics</a></span></dt> | |
78 | <dt><span class="section"><a href="boost_numericconversion/type_requirements_and_user_defined_types_support.html#boost_numericconversion.type_requirements_and_user_defined_types_support.special_policies">Special | |
79 | Policies</a></span></dt> | |
80 | <dt><span class="section"><a href="boost_numericconversion/type_requirements_and_user_defined_types_support.html#boost_numericconversion.type_requirements_and_user_defined_types_support.udts_with_numeric_cast">UDTs | |
81 | with numeric_cast</a></span></dt> | |
82 | </dl></dd> | |
83 | <dt><span class="section"><a href="boost_numericconversion/bounds___traits_class.html">bounds<> | |
84 | traits class</a></span></dt> | |
85 | <dd><dl> | |
86 | <dt><span class="section"><a href="boost_numericconversion/bounds___traits_class.html#boost_numericconversion.bounds___traits_class.introduction">Introduction</a></span></dt> | |
87 | <dt><span class="section"><a href="boost_numericconversion/bounds___traits_class.html#boost_numericconversion.bounds___traits_class.traits_class_bounds_n_">traits | |
88 | class bounds<N></a></span></dt> | |
89 | <dt><span class="section"><a href="boost_numericconversion/bounds___traits_class.html#boost_numericconversion.bounds___traits_class.examples">Examples</a></span></dt> | |
90 | </dl></dd> | |
91 | <dt><span class="section"><a href="boost_numericconversion/conversion_traits___traits_class.html">conversion_traits<> | |
92 | traits class</a></span></dt> | |
93 | <dd><dl> | |
94 | <dt><span class="section"><a href="boost_numericconversion/conversion_traits___traits_class.html#boost_numericconversion.conversion_traits___traits_class.types">Types</a></span></dt> | |
95 | <dt><span class="section"><a href="boost_numericconversion/conversion_traits___traits_class.html#boost_numericconversion.conversion_traits___traits_class.examples">Examples</a></span></dt> | |
96 | </dl></dd> | |
97 | <dt><span class="section"><a href="boost_numericconversion/numeric_converter_policy_classes.html">Numeric | |
98 | Converter Policy Classes</a></span></dt> | |
99 | <dd><dl> | |
100 | <dt><span class="section"><a href="boost_numericconversion/numeric_converter_policy_classes.html#boost_numericconversion.numeric_converter_policy_classes.enum_range_check_result">enum | |
101 | range_check_result</a></span></dt> | |
102 | <dt><span class="section"><a href="boost_numericconversion/numeric_converter_policy_classes.html#boost_numericconversion.numeric_converter_policy_classes.policy_overflowhandler">Policy | |
103 | OverflowHandler</a></span></dt> | |
104 | <dt><span class="section"><a href="boost_numericconversion/numeric_converter_policy_classes.html#boost_numericconversion.numeric_converter_policy_classes.policy_float2introunder">Policy | |
105 | Float2IntRounder</a></span></dt> | |
106 | <dt><span class="section"><a href="boost_numericconversion/numeric_converter_policy_classes.html#boost_numericconversion.numeric_converter_policy_classes.policy_rawconverter">Policy | |
107 | RawConverter</a></span></dt> | |
108 | <dt><span class="section"><a href="boost_numericconversion/numeric_converter_policy_classes.html#boost_numericconversion.numeric_converter_policy_classes.policy_userrangechecker">Policy | |
109 | UserRangeChecker</a></span></dt> | |
110 | </dl></dd> | |
111 | <dt><span class="section"><a href="boost_numericconversion/improved_numeric_cast__.html">Improved | |
112 | numeric_cast<></a></span></dt> | |
113 | <dd><dl> | |
114 | <dt><span class="section"><a href="boost_numericconversion/improved_numeric_cast__.html#boost_numericconversion.improved_numeric_cast__.introduction">Introduction</a></span></dt> | |
115 | <dt><span class="section"><a href="boost_numericconversion/improved_numeric_cast__.html#boost_numericconversion.improved_numeric_cast__.numeric_cast">numeric_cast</a></span></dt> | |
116 | <dt><span class="section"><a href="boost_numericconversion/improved_numeric_cast__.html#boost_numericconversion.improved_numeric_cast__.numeric_cast_traits">numeric_cast_traits</a></span></dt> | |
117 | <dt><span class="section"><a href="boost_numericconversion/improved_numeric_cast__.html#boost_numericconversion.improved_numeric_cast__.examples">Examples</a></span></dt> | |
118 | </dl></dd> | |
119 | <dt><span class="section"><a href="numeric_conversion/history_and_acknowledgments.html">History | |
120 | and Acknowledgments</a></span></dt> | |
121 | <dt><span class="section"><a href="numeric_conversion/bibliography.html">Bibliography</a></span></dt> | |
122 | </dl> | |
123 | </div> | |
124 | <div class="section"> | |
125 | <div class="titlepage"><div><div><h2 class="title" style="clear: both"> | |
126 | <a name="numeric_conversion.overview"></a><a class="link" href="index.html#numeric_conversion.overview" title="Overview">Overview</a> | |
127 | </h2></div></div></div> | |
128 | <p> | |
129 | The Boost Numeric Conversion library is a collection of tools to describe and | |
130 | perform conversions between values of different <a class="link" href="boost_numericconversion/definitions.html#boost_numericconversion.definitions.numeric_types" title="Numeric Types">numeric | |
131 | types</a>. | |
132 | </p> | |
133 | <p> | |
134 | The library includes a special alternative for a subset of <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">numeric_limits</span><span class="special"><></span></code>, the <a class="link" href="boost_numericconversion/bounds___traits_class.html" title="bounds<> traits class">bounds<></a> | |
135 | traits class, which provides a consistent way to obtain the <a class="link" href="boost_numericconversion/definitions.html#boost_numericconversion.definitions.range_and_precision" title="Range and Precision">boundary</a> | |
136 | values for the <a class="link" href="boost_numericconversion/definitions.html#boost_numericconversion.definitions.range_and_precision" title="Range and Precision">range</a> | |
137 | of a numeric type. | |
138 | </p> | |
139 | <p> | |
140 | It also includes a set of <a class="link" href="boost_numericconversion/conversion_traits___traits_class.html" title="conversion_traits<> traits class">trait | |
141 | classes</a> which describes the compile-time properties of a conversion | |
142 | from a source to a target numeric type. Both <a class="link" href="boost_numericconversion/definitions.html#boost_numericconversion.definitions.c___arithmetic_types" title="C++ Arithmetic Types">arithmetic</a> | |
143 | and <a class="link" href="boost_numericconversion/definitions.html#boost_numericconversion.definitions.numeric_types" title="Numeric Types">user-defined | |
144 | numeric types</a> can be used. | |
145 | </p> | |
146 | <p> | |
147 | A policy-based <a class="link" href="boost_numericconversion/converter___function_object.html" title="converter<> function object">converter</a> | |
148 | object which uses <code class="computeroutput"><span class="identifier">conversion_traits</span></code> | |
149 | to select an optimized implementation is supplied. Such implementation uses | |
150 | an optimal range checking code suitable for the source/target combination. | |
151 | </p> | |
152 | <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> | |
153 | <li class="listitem"> | |
154 | The converter's out-of-range behavior can be customized via an <a class="link" href="boost_numericconversion/numeric_converter_policy_classes.html#boost_numericconversion.numeric_converter_policy_classes.policy_overflowhandler" title="Policy OverflowHandler">OverflowHandler</a> | |
155 | policy. | |
156 | </li> | |
157 | <li class="listitem"> | |
158 | For floating-point to integral conversions, the rounding mode can be selected | |
159 | via the <a class="link" href="boost_numericconversion/numeric_converter_policy_classes.html#boost_numericconversion.numeric_converter_policy_classes.policy_float2introunder" title="Policy Float2IntRounder">Float2IntRounder</a> | |
160 | policy. | |
161 | </li> | |
162 | <li class="listitem"> | |
163 | A custom low-level conversion routine (for UDTs for instance) can be passed | |
164 | via a <a class="link" href="boost_numericconversion/numeric_converter_policy_classes.html#boost_numericconversion.numeric_converter_policy_classes.policy_rawconverter" title="Policy RawConverter">RawConverter</a> | |
165 | policy. | |
166 | </li> | |
167 | <li class="listitem"> | |
168 | The optimized automatic range-checking logic can be overridden via a <a class="link" href="boost_numericconversion/numeric_converter_policy_classes.html#boost_numericconversion.numeric_converter_policy_classes.policy_userrangechecker" title="Policy UserRangeChecker">UserRangeChecker</a> | |
169 | policy. | |
170 | </li> | |
171 | </ul></div> | |
172 | </div> | |
173 | </div> | |
174 | <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> | |
175 | <td align="left"><p><small>Last revised: June 02, 2014 at 09:10:01 GMT</small></p></td> | |
176 | <td align="right"><div class="copyright-footer"></div></td> | |
177 | </tr></table> | |
178 | <hr> | |
179 | <div class="spirit-nav"><a accesskey="n" href="boost_numericconversion/definitions.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a></div> | |
180 | </body> | |
181 | </html> |