What is the complexity of std::string::substr member function? Is it defined by standard or implementation-defined?
std::string::substr
A na?ve implementation would be O(k) where k is the length of the resulting substring. std::string does not support copy-on-write. If you want O(1) substring operations, use a data structure such as a Rope.
1.4m articles
1.4m replys
5 comments
57.0k users