When should std::string be used over character arrays?
const char* is a throwback to C. I’d say that in decent C++, about the only use for it is in extern “C” APIs. std::string has a number of advantages: It provides a constant-time size() function. Discovering the length of a const char* takes linear time. It is guaranteed to be valid. A const char* … Read more