Copyright © 2008 Howard Hinnant
Copyright © 2006, 2008 Beman Dawes
Copyright © 2009-2012 Vicente J. Botet Escriba
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)
Table of Contents
This documentation makes use of the following naming and formatting conventions.
fixed width fontand is syntax-highlighted.
(), as in
class_template<>; that is, it is in code font and its name is followed by
<>to indicate that it is a class template.
MACRO(); that is, it is uppercase in code font and its name is followed by
()to indicate that it is a function-like macro. Object-like macros appear without the trailing
In addition, notes such as this one specify non-essential information that provides additional background or rationale.
Finally, you can mentally add the following to any code fragments in this document:
// Include all of Ratio files #include <boost/ratio.hpp> using namespace boost;
Boost.Ratio aims to implement the compile time ratio facility in C++0x, as proposed in N2661 - A Foundation to Sleep On. That document provides background and motivation for key design decisions and is the source of a good deal of information in this documentation.
The Boost.Ratio library provides:
ratio, for specifying compile time rational constants such as 1/3 of a nanosecond or the number of inches per meter.
ratiorepresents a compile time ratio of compile time constants with support for compile time arithmetic with overflow and division by zero protection.
boost::ratio<N, D>in the form of a
std::basic_stringwhich can be useful for I/O.
ratio<> in the context of Boost.MPL numeric metafunctions.