Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

Chapter 26. Boost.Units 1.1.0
PrevUpHomeNext

Chapter 26. Boost.Units 1.1.0

Matthias C. Schabel

Steven Watanabe

Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

The Boost.Units library is a C++ implementation of dimensional analysis in a general and extensible manner, treating it as a generic compile-time metaprogramming problem. With appropriate compiler optimization, no runtime execution cost is introduced, facilitating the use of this library to provide dimension checking in performance-critical code. Support for units and quantities (defined as a unit and associated value) for arbitrary unit system models and arbitrary value types is provided, as is a fine-grained general facility for unit conversions. Complete SI and CGS unit systems are provided, along with systems for angles measured in degrees, radians, gradians, and revolutions and systems for temperatures measured in Kelvin, degrees Celsius and degrees Fahrenheit. The library architecture has been designed with flexibility and extensibility in mind; demonstrations of the ease of adding new units and unit conversions are provided in the examples.

In order to enable complex compile-time dimensional analysis calculations with no runtime overhead, Boost.Units relies heavily on the Boost Metaprogramming Library (MPL) and on template metaprogramming techniques, and is, as a consequence, fairly demanding of compiler compliance to ISO standards. At present, it has been successfully compiled and tested on the following compilers/platforms :

  1. g++ 4.0.1 on Mac OSX 10.4
  2. Intel CC 9.1, 10.0, and 10.1 on Mac OSX 10.4
  3. g++ 3.4.4, 4.2.3, and 4.3.0 on Windows XP
  4. Microsoft Visual C++ 7.1, 8.0, and 9.0 on Windows XP
  5. Comeau 4.3.10.1 beta2 on Windows XP
  6. Metrowerks CodeWarrior 9.2 on Windows XP.
  7. Sun CC 5.9 on Solaris and Linux

The following compilers/platforms are known not to work :

  1. g++ 3.3.x
  2. Microsoft Visual C++ 6.0 on Windows XP
  3. Microsoft Visual C++ 7.0 on Windows XP
  4. Metrowerks CodeWarrior 8.0 on Windows XP.
  5. All versions of Borland.

Last revised: March 08, 2011 at 23:39:38 GMT


PrevUpHomeNext