Alright, it might be a stupid question, but I will go ahead and ask anyway.
So, I was wondering, what are all the possible errors associated with std::string usage ? I know a few, for example accessing char at location greater then the std::string size in various std::string functions.
While programming what errors should I keep in mind and place checks on ?
And is there an another way to do following for example, efficiently ?
std::string s("some string.");
int i = s.find ( "." );
if ( i != std::string::npos && i + 3 < s.length ( ) ) // <<== this check is what I am talking about
s.erase ( i + 3 );
I have a program, which requires hundreds of such checks, so I was wondering, there was an another way then to do if( some_condition ) each time.