yakra / DataProcessing

Data Processing Scripts and Programs for Travel Mapping Project
0 stars 0 forks source link

substring ctor #187

Closed yakra closed 1 year ago

yakra commented 2 years ago

Constructing a new std::string via a const char* makes less sense in cases where a substring ctor (or equivalent assign()) can be used. It means iterating thru the string once to find the null terminator (strlen) to know how much memory to allocate, then again to copy. Why do that when we can take advantage of std::string::size()?

yakra commented 1 year ago

See https://github.com/yakra/DataProcessing/issues/191#issuecomment-933168125