None
CY
Two C++ bugs I wrote
['Andrew Helwer']
Andrew Helwer
All of this is to say I stored the string I wanted to parse in a std::vector<char> rather than a std::string , then used the std::vector<char>::data() function to get a pointer to the underlying data to pass to atoi() . Instead, C strings are just a pointer to some memory address, and the string is just whatever you read starting at that address until hitting a byte with value 0 . In the implementations I’ve seen though, calling pop_back on an empty vector just leaves the vector unchanged but decrements the size of the vector.