Hello all. I am writing a quick and dirty parser. I have code that wants to consume everything up to the end of a tag. I write this to find an #INDUCTION tag:
myCopy.erase(0, myCopy.find("#INDUCTION") + 10);
This works wonderfully, unless myCopy.find("#INDUCTION") == 0. Then it erases nothing. It works properly in all other cases.
I thought size_t(0) might be special, but this works fine:
+ static_cast<std::size_t>(9) in my actual code doesn't work either.
vvvvvvvvvvvvvvvvvvv The response right below this post probably doesn't make sense because I edited the code.
myCopy.erase(0, myCopy.find("#INDUCTION") + 10);
This works wonderfully, unless myCopy.find("#INDUCTION") == 0. Then it erases nothing. It works properly in all other cases.
I thought size_t(0) might be special, but this works fine:
Code:
size_t test = 0;
test += 9;
+ static_cast<std::size_t>(9) in my actual code doesn't work either.
vvvvvvvvvvvvvvvvvvv The response right below this post probably doesn't make sense because I edited the code.
