I would like to make my own implementation of the c++ std::basic_string template class for a project of mine and I would like to know the logic behind it.
For example: I heard that at first the c++ std::basic_string isn't a dynamically allocated string and in fact is a 19 long c string or null terminated string, if the string needs to be longer then it will become a dynamically allocated string, which improves the speed.
As a question I would like to know how to manage the memory of the string, like, if you need more space you would reallocate memory or allocate another memory block and connect the 2 memory blocks somehow to improve the performance, but I think that it will significantly improve the complexity of the code.