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

This is the documentation for an old version of Boost. Click here to view this page for the latest version.


namespace boost{ namespace multiprecision{

template <class IntBackend>
class rational_adpater;


The class template rational_adaptor is a back-end for number which converts any existing integer back-end into a rational-number back-end.

So for example, given an integer back-end type MyIntegerBackend, the use would be something like:

typedef number<MyIntegerBackend>                    MyInt;
typedef number<rational_adaptor<MyIntegerBackend> > MyRational;

MyRational r = 2;
r /= 3;
MyInt i = numerator(r);
assert(i == 2);