If I use
const char * str = "Hello";
there is no memory allocation/deallocaton needed in runtime
If I use
const std::string str = "Hello";
will be there an allocation via new/malloc inside string class or not? I could find it in assembly, but I am not good at reading it.
If answer is "yes, there will be malloc/new", why? Why can there be only pass through to inner const char pointer inside std::string and do actual memory allocation if I need to edit edit string?
char str[] = "Hello";orconst std::string str = "Hello";or evenstatic const std::string str = "Hello".