I hear that spirit is really fast at converting string to int.
I am however unable to create a simple function that can do so. Something like
int string_to_int(string& s) {
/*?????*/
}
Can anybody use boost spirit to fill in this function.
By the way I am working on boost 1.34 and not the latest version.
There are several ways to achieve this:
or a shorter:
which is based on Spirit’s
autofeatures. If you wrap one of these into a function, you get what you want.EDIT: I saw only now that you’re using Boost 1.34. So here is the corresponding incantation for this: