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
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.
// forwards to <boost/spirit/home/qi/numeric.hpp> #include <boost/spirit/include/qi_numeric.hpp>
Also, see Include Structure.