I am trying to learn a little more about C ++ strings.
consider
const char* cstring = "hello";
std::string string(cstring);
and
std::string string("hello");
Do I correctly assume that both store "hello" in the application's .data section, and then the bytes are copied to another area on the heap, where a pointer controlled by std :: string can access them?
How can I effectively store a really very long string? I kind of think of an application that reads data from a socket stream. I am afraid to concatenate many times. I could imagine using a linked list and cross that list.
The lines scared me for too long!
Any links, tips, explanations, further details will be extremely useful.
source
share