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

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

Numeric Generators

Unsigned Integer Number Generators (uint_, etc.)
Signed Integer Number Generators (int_, etc.)
Real Number Generators (float_, double_, etc.)
Boolean Generators (bool_)

The library includes a couple of predefined objects for generating booleans, signed and unsigned integers, and real numbers. These generators are fully parametric. Most of the important aspects of numeric generation can be finely adjusted to suit. This includes the radix base, the exponent, the fraction etc. Policies control the real number generators' behavior. There are some predefined policies covering the most common real number formats but the user can supply her own when needed.

The numeric parsers are fine tuned (employing loop unrolling and extensive template metaprogramming) with exceptional performance that rivals the low level C functions such as ltoa, ssprintf, and _gcvt. Benchmarks reveal up to 2X speed over the C counterparts (see here: Performance of Numeric Generators). This goes to show that you can write extremely tight generic C++ code that rivals, if not surpasses C.

Module Header
// forwards to <boost/spirit/home/karma/numeric.hpp>
#include <boost/spirit/include/karma_numeric.hpp>

Also, see Include Structure.


PrevUpHomeNext