Yes, I think the semantics of c_str() and data() effectively require that it is stored contiguously.
Although it is still possible to make it faster by overallocating in the same way as std::vector, but at the cost of more memory use.
Although it is still possible to make it faster by overallocating in the same way as std::vector, but at the cost of more memory use.
According to that link, c_str() and data() work in constant time. With that restriction, it's impossible to do the joining lazily - it must be done when data is added to the string.
An answer to http://programmers.stackexchange.com/questions/124731/what-p... indicates that C++03 doesn't require constnat time, either.
Thanks for the education.