#include #include #include #include void Str2Int(const std::string& str) { int result; std::cout << "Parsing '" << str << "':\n"; std::string::const_iterator i = str.begin(); if (!boost::spirit::qi::parse(i, str.end(), boost::spirit::int_, result)){ std::cout << " parse failed\n"; return; } else { std::cout << " parse success " << result << "\n"; } if( i != str.end() ) std::cout << " have leftovers\n"; } int main(){ std::cout << "sizeof(int): " << sizeof(int) << "\n"; Str2Int( "2147483647" ); Str2Int( "2147483648" ); return 0; }