I need to parse a wstring to int, float or a string itself. I found a question similar to mine Here but I don’t understand how to use the parser. I don’t find the test_parser method. The question is: after implementing the custom rules for the parser, how to use them?
Share
Parsing a wstring to an int is straight forward:
Similarily, parsing a float looks like:
I’m not sure what you mean by ‘parsing a string’. If you mean it as parsing a quoted string you could write it as:
the expession
'"' >> *~qi::char_('"') >> '"'means: a quote ('"') followed by (>>) zero or more (*) characters which are not a quote (~qi::char_('"')) followed by (>>) another quote ('"') .