I have a variable that's guaranteed to be a single character (substr from a std::string
).
I strongly suspect that it's more efficient to use a char
, i.e.
char c = name.c_str()[offset];
instead of the more complicated (and costly)
std::string c = name.substr(offset, 1);
I'm not going to do any intensive operations on the resulting character (just one switch
statement).