Back to Alisql

Chapter 35. Boost.Ratio 2.1.0

extra/boost/boost_1_77_0/doc/html/ratio.html

latest3.4 KB
Original Source

| | Home | Libraries | People | FAQ | More |


Chapter 35. Boost.Ratio 2.1.0

Howard Hinnant

Beman Dawes

Vicente J. Botet Escriba

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)

Overview

How to Use This Documentation

This documentation makes use of the following naming and formatting conventions.

  • Code is in fixed width font and is syntax-highlighted.
  • Replaceable text that you will need to supply is in italics.
  • Free functions are rendered in the code font followed by (), as in free_function().
  • If a name refers to a class template, it is specified like this: class_template<>; that is, it is in code font and its name is followed by <> to indicate that it is a class template.
  • If a name refers to a function-like macro, it is specified like this: 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 ().
  • Names that refer to concepts in the generic programming sense are specified in CamelCase.

| | Note | |

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\>usingnamespaceboost;

Motivation

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.

Description

The Boost.Ratio library provides:

  • A class template, ratio, for specifying compile time rational constants such as 1/3 of a nanosecond or the number of inches per meter. ratio represents a compile time ratio of compile time constants with support for compile time arithmetic with overflow and division by zero protection.
  • It provides a textual representation of boost::ratio<N, D> in the form of a std::basic_string which can be useful for I/O.
  • Some extension related to the Rational Constant concept enabling the use of ratio<> in the context of Boost.MPL numeric metafunctions.

|

Last revised: August 05, 2021 at 09:53:07 GMT

|

|