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 43. Boost.Units 1.1.0</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="typeof/ackn.html" title="Acknowledgements"> 11<link rel="next" href="boost_units/Quick_Start.html" title="Quick Start"> 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="typeof/ackn.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="boost_units/Quick_Start.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="boost_units"></a>Chapter 43. Boost.Units 1.1.0</h2></div> 30<div><div class="author"><h3 class="author"> 31<span class="firstname">Matthias C.</span> <span class="surname">Schabel</span> 32</h3></div></div> 33<div><div class="author"><h3 class="author"> 34<span class="firstname">Steven</span> <span class="surname">Watanabe</span> 35</h3></div></div> 36<div><p class="copyright">Copyright © 2003-2008 Matthias Christian Schabel</p></div> 37<div><p class="copyright">Copyright © 2007-2010 Steven 38 Watanabe</p></div> 39<div><div class="legalnotice"> 40<a name="boost_units.legal"></a><p> 41 Distributed under the Boost Software License, Version 1.0. (See accompanying 42 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>) 43 </p> 44</div></div> 45</div></div> 46<div class="toc"> 47<p><b>Table of Contents</b></p> 48<dl class="toc"> 49<dt><span class="section"><a href="boost_units.html#boost_units.Introduction">Introduction</a></span></dt> 50<dt><span class="section"><a href="boost_units/Quick_Start.html">Quick Start</a></span></dt> 51<dt><span class="section"><a href="boost_units/Dimensional_Analysis.html">Dimensional Analysis</a></span></dt> 52<dt><span class="section"><a href="boost_units/Units.html">Units</a></span></dt> 53<dd><dl> 54<dt><span class="section"><a href="boost_units/Units.html#boost_units.Units.base_units">Base Units</a></span></dt> 55<dt><span class="section"><a href="boost_units/Units.html#boost_units.Units.scaled_base_units">Scaled Base Units</a></span></dt> 56<dt><span class="section"><a href="boost_units/Units.html#boost_units.Units.scaled_units">Scaled Units</a></span></dt> 57</dl></dd> 58<dt><span class="section"><a href="boost_units/Quantities.html">Quantities</a></span></dt> 59<dd><dl> 60<dt><span class="section"><a href="boost_units/Quantities.html#boost_units.Quantities.Heterogeneous_Operators">Heterogeneous 61 Operators</a></span></dt> 62<dt><span class="section"><a href="boost_units/Quantities.html#boost_units.Quantities.Conversions">Conversions</a></span></dt> 63<dt><span class="section"><a href="boost_units/Quantities.html#boost_units.Quantities.Quantity_Construction_and_Conversion">Construction 64 and Conversion of Quantities</a></span></dt> 65</dl></dd> 66<dt><span class="section"><a href="boost_units/Examples.html">Examples</a></span></dt> 67<dd><dl> 68<dt><span class="section"><a href="boost_units/Examples.html#boost_units.Examples.DimensionExample">Dimension Example</a></span></dt> 69<dt><span class="section"><a href="boost_units/Examples.html#boost_units.Examples.UnitExample">Unit Example</a></span></dt> 70<dt><span class="section"><a href="boost_units/Examples.html#boost_units.Examples.QuantityExample">Quantity Example</a></span></dt> 71<dt><span class="section"><a href="boost_units/Examples.html#boost_units.Examples.KitchenSinkExample">Kitchen Sink 72 Example using SI units</a></span></dt> 73<dt><span class="section"><a href="boost_units/Examples.html#boost_units.Examples.ConversionExample">Conversion Example</a></span></dt> 74<dt><span class="section"><a href="boost_units/Examples.html#boost_units.Examples.UDTExample">User Defined Types</a></span></dt> 75<dt><span class="section"><a href="boost_units/Examples.html#boost_units.Examples.ComplexExample">Complex Example</a></span></dt> 76<dt><span class="section"><a href="boost_units/Examples.html#boost_units.Examples.PerformanceExample">Performance 77 Example</a></span></dt> 78<dt><span class="section"><a href="boost_units/Examples.html#boost_units.Examples.RadarBeamHeightExample">Radar Beam 79 Height</a></span></dt> 80<dt><span class="section"><a href="boost_units/Examples.html#boost_units.Examples.HeterogeneousUnitExample">Heterogeneous 81 Unit Example</a></span></dt> 82<dt><span class="section"><a href="boost_units/Examples.html#boost_units.Examples.AbsoluteRelativeTemperatureExample">Absolute 83 and Relative Temperature Example</a></span></dt> 84<dt><span class="section"><a href="boost_units/Examples.html#boost_units.Examples.RuntimeConversionFactorExample">Runtime 85 Conversion Factor Example</a></span></dt> 86<dt><span class="section"><a href="boost_units/Examples.html#boost_units.Examples.UnitsWithNonbaseDimensions">Units 87 with Non-base Dimensions</a></span></dt> 88<dt><span class="section"><a href="boost_units/Examples.html#boost_units.Examples.OutputForCompositeUnits">Output 89 for Composite Units</a></span></dt> 90<dt><span class="section"><a href="boost_units/Examples.html#boost_units.Examples.autoscale">Automatically Scaled 91 Units</a></span></dt> 92<dt><span class="section"><a href="boost_units/Examples.html#boost_units.Examples.ConversionFactor">Conversion Factor</a></span></dt> 93<dt><span class="section"><a href="boost_units/Examples.html#boost_units.Examples.RuntimeUnits">Runtime Units</a></span></dt> 94<dt><span class="section"><a href="boost_units/Examples.html#boost_units.Examples.lambda">Interoperability with Boost.Lambda</a></span></dt> 95</dl></dd> 96<dt><span class="section"><a href="boost_units/Utilities.html">Utilities</a></span></dt> 97<dd><dl> 98<dt><span class="section"><a href="boost_units/Utilities.html#boost_units.Utilities.Metaprogramming_Classes">Metaprogramming 99 Classes</a></span></dt> 100<dt><span class="section"><a href="boost_units/Utilities.html#boost_units.Utilities.Metaprogramming_Predicates">Metaprogramming 101 Predicates</a></span></dt> 102</dl></dd> 103<dt><span class="section"><a href="boost_units/Reference.html">Reference</a></span></dt> 104<dd><dl> 105<dt><span class="section"><a href="boost_units/Reference.html#units_reference">Units Reference</a></span></dt> 106<dt><span class="section"><a href="boost_units/Reference.html#dimensions_reference">Dimensions Reference</a></span></dt> 107<dt><span class="section"><a href="boost_units/Reference.html#si_system_reference">SI System Reference</a></span></dt> 108<dt><span class="section"><a href="boost_units/Reference.html#cgs_system_reference">CGS System Reference</a></span></dt> 109<dt><span class="section"><a href="boost_units/Reference.html#trigonometry_and_angle_system_reference">Trigonometry and Angle System Reference</a></span></dt> 110<dt><span class="section"><a href="boost_units/Reference.html#temperature_system_reference">Temperature System Reference</a></span></dt> 111<dt><span class="section"><a href="boost_units/Reference.html#information_system_reference">Information System Reference</a></span></dt> 112<dt><span class="section"><a href="boost_units/Reference.html#abstract_system_reference">Abstract System Reference</a></span></dt> 113<dt><span class="section"><a href="boost_units/Reference.html#boost_units.Reference.base_units_by_category">Base Units 114 by Category</a></span></dt> 115<dt><span class="section"><a href="boost_units/Reference.html#boost_units.Reference.alphabetical_listing_of_base_units">Alphabetical 116 Listing of Base Units</a></span></dt> 117</dl></dd> 118<dt><span class="section"><a href="boost_units/Installation.html">Installation</a></span></dt> 119<dt><span class="section"><a href="boost_units/FAQ.html">FAQ</a></span></dt> 120<dd><dl> 121<dt><span class="section"><a href="boost_units/FAQ.html#boost_units.FAQ.Distinguishing_Quantities_With_Same_Units">How 122 does one distinguish between quantities that are physically different but have 123 the same units (such as energy and torque)?</a></span></dt> 124<dt><span class="section"><a href="boost_units/FAQ.html#boost_units.FAQ.Angle_Are_Units">Angles are treated as 125 units</a></span></dt> 126<dt><span class="section"><a href="boost_units/FAQ.html#boost_units.FAQ.Why_Homogeneous_Systems">Why are there 127 homogeneous systems? Aren't heterogeneous systems sufficient?</a></span></dt> 128<dt><span class="section"><a href="boost_units/FAQ.html#boost_units.FAQ.NoConstructorFromValueType">Why can't 129 I construct a quantity directly from the value type?</a></span></dt> 130<dt><span class="section"><a href="boost_units/FAQ.html#boost_units.FAQ.ExplicitConversions">Why are conversions 131 explicit by default?</a></span></dt> 132</dl></dd> 133<dt><span class="section"><a href="boost_units/Acknowledgements.html">Acknowledgements</a></span></dt> 134<dt><span class="section"><a href="boost_units/HelpWanted.html">Help Wanted</a></span></dt> 135<dt><span class="section"><a href="boost_units/version_id.html">Version Info</a></span></dt> 136<dt><span class="section"><a href="boost_units/ReleaseNotes.html">Release Notes</a></span></dt> 137<dt><span class="section"><a href="boost_units/TODO.html">TODO</a></span></dt> 138</dl> 139</div> 140<div class="section"> 141<div class="titlepage"><div><div><h2 class="title" style="clear: both"> 142<a name="boost_units.Introduction"></a><a class="link" href="boost_units.html#boost_units.Introduction" title="Introduction">Introduction</a> 143</h2></div></div></div> 144<p> 145 The Boost.Units library is a C++ implementation of dimensional analysis in 146 a general and extensible manner, treating it as a generic compile-time metaprogramming 147 problem. With appropriate compiler optimization, no runtime execution cost 148 is introduced, facilitating the use of this library to provide dimension checking 149 in performance-critical code. Support for units and quantities (defined as 150 a unit and associated value) for arbitrary unit system models and arbitrary 151 value types is provided, as is a fine-grained general facility for unit conversions. 152 Complete SI and CGS unit systems are provided, along with systems for angles 153 measured in degrees, radians, gradians, and revolutions and systems for temperatures 154 measured in Kelvin, degrees Celsius and degrees Fahrenheit. The library architecture 155 has been designed with flexibility and extensibility in mind; demonstrations 156 of the ease of adding new units and unit conversions are provided in the examples. 157 </p> 158<p> 159 In order to enable complex compile-time dimensional analysis calculations with 160 no runtime overhead, Boost.Units relies heavily on the <span class="underline"><a href="http://www.boost.org/libs/mpl/doc/index.html" target="_top">Boost Metaprogramming Library</a></span> 161 (MPL) and on template metaprogramming techniques, and is, as a consequence, 162 fairly demanding of compiler compliance to ISO standards. At present, it has 163 been successfully compiled and tested on the following compilers/platforms 164 : 165 </p> 166<div class="orderedlist"><ol class="orderedlist" type="1"> 167<li class="listitem"> 168 g++ 4.0.1 on Mac OSX 10.4 169 </li> 170<li class="listitem"> 171 Intel CC 9.1, 10.0, and 10.1 on Mac OSX 10.4 172 </li> 173<li class="listitem"> 174 g++ 3.4.4, 4.2.3, and 4.3.0 on Windows XP 175 </li> 176<li class="listitem"> 177 Microsoft Visual C++ 7.1, 8.0, and 9.0 on Windows XP 178 </li> 179<li class="listitem"> 180 Comeau 4.3.10.1 beta2 on Windows XP 181 </li> 182<li class="listitem"> 183 Metrowerks CodeWarrior 9.2 on Windows XP. 184 </li> 185<li class="listitem"> 186 Sun CC 5.9 on Solaris and Linux 187 </li> 188</ol></div> 189<p> 190 The following compilers/platforms are known <span class="bold"><strong>not</strong></span> 191 to work : 192 </p> 193<div class="orderedlist"><ol class="orderedlist" type="1"> 194<li class="listitem"> 195 g++ 3.3.x 196 </li> 197<li class="listitem"> 198 Microsoft Visual C++ 6.0 on Windows XP 199 </li> 200<li class="listitem"> 201 Microsoft Visual C++ 7.0 on Windows XP 202 </li> 203<li class="listitem"> 204 Metrowerks CodeWarrior 8.0 on Windows XP. 205 </li> 206<li class="listitem"> 207 All versions of Borland. 208 </li> 209</ol></div> 210</div> 211</div> 212<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> 213<td align="left"><p><small>Last revised: August 11, 2020 at 15:03:11 GMT</small></p></td> 214<td align="right"><div class="copyright-footer"></div></td> 215</tr></table> 216<hr> 217<div class="spirit-nav"> 218<a accesskey="p" href="typeof/ackn.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="boost_units/Quick_Start.html"><img src="../../doc/src/images/next.png" alt="Next"></a> 219</div> 220</body> 221</html> 222