Boost C++ Libraries Home Libraries People FAQ More

PrevUpHomeNext

Numeric Parsers

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

The library includes a couple of predefined objects for parsing signed and unsigned integers and real numbers. These parsers are fully parametric. Most of the important aspects of numeric parsing can be finely adjusted to suit. This includes the radix base, the minimum and maximum number of allowable digits, the exponent, the fraction etc. Policies control the real number parsers' 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 atof, strtod, atol, strtol. Benchmarks reveal up to 4X speed over the C counterparts. 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/qi/numeric.hpp>
#include <boost/spirit/include/qi_numeric.hpp>

Also, see Include Structure.


PrevUpHomeNext