
``` #include <boost/parser/parser.hpp> #include <iostream> #include <string> #include <variant> namespace bp = boost::parser; auto numeric_parser = bp::int_ | bp::double_; //auto numeric_parser = bp::double_ | bp::int_; void parse_number(const std::string& input) { auto result = bp::parse(input, numeric_parser); if (result) { std::visit([](auto&& arg) { using T = std::decay_t<decltype(arg)>; if constexpr (std::is_same_v<T, int>) std::cout << "Integer: " << arg << std::endl; else if constexpr (std::is_same_v<T, double>) std::cout << "double: " << arg << std::endl; }, *result); } else { std::cout << "Parsing failed:" << " (" << input << ")" << std::endl; } } int main() { parse_number("24"); parse_number("24.3"); return 0; } ``` Above code failed to parse "24.3" which makes me confused. First int should failed but why it didn't match double? If use ``` auto numeric_parser = bp::double_ | bp::int_; ``` then all number parsed to double.