How to write a boost::spirit::qi parser to parse an integer range from 0 to std::numeric_limits<int>::max()?
问题 I tried to use qi::uint_parser<int>() . But it is the same like qi::uint_ . They all match integers range from 0 to std::numeric_limits<unsigned int>::max() . Is qi::uint_parser<int>() designed to be like this? What parser shall I use to match an integer range from 0 to std::numeric_limits<int>::max() ? Thanks. 回答1: Simplest demo, attaching a semantic action to do the range check: uint_ [ _pass = (_1>=0 && _1<=std::numeric_limits<int>::max()) ]; Live On Coliru #include <boost/spirit/include