this is quite a simple question, however I'm finding it tricky. I want to treat a char*
as if it were a std::string
, for instance:
char *p = ...; // read a huge chuck from a file
std::string s(p); // this is not what I want
So, if I use the constructor, I get a copy of p, which is a waste of memory and time. Is it possible somehow to avoid this, and "assign" the std::string
content to a pre-existing address?
Any other idea is more than welcome!
Thanks!