Comparing version numbers as strings is not so easy…
“1.0.0.9” > “1.0.0.10”, but it’s not correct.
The obvious way to do it properly is to parse these strings, convert to numbers and compare as numbers.
Is there another way to do it more “elegantly”? For example, boost::string_algo…
Comparing version numbers as strings is not so easy… 1.0.0.9 > 1.0.0.10, but it’s
Share
I don’t see what could be more elegant than just parsing — but please make use of standard library facilities already in place. Assuming you don’t need error checking:
Anything more complicated is going to be harder to maintain and isn’t worth your time.