سؤال

All my attempts so far have failed.Basically when I return a copy of the internal char array of the string, that copy has to be released, but I don't know how to release it.Wrapping it in a smart pointer doesn't work out, since it's destructor gets called immediately after I return it.Must I implement something like a garbage collector just for the immutable string?

هل كانت مفيدة؟

المحلول

const std::string will be fine.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top