std::string str1{"This is a test string"};
std::string str2{std::move(str1)};
str1 = "This is a new content of this string";
// Use str1...
Am I correct thinking that str1
is in valid state now and is totally safe to use after assigning new value to it?
Am I correct thinking that
str1
is in valid state now and is totally safe to use after assigning new value to it?
Yes, you can safely assign to str1
(as you've done) and then use str1
for further purposes.