What is the complexity of std::string::substr member function? Is it defined by standard or implementation-defined?
std::string::substr
The C++11 standard does not define the performance characteristics of substr, either in 21.4.7.8 or anywhere else I could find. In practice you can almost certainly expect O(n) performance with n being the length of the result.
substr
O(n)
n