I know this is a very simple, maybe even awkward question, but it's hard for me to figure it out. If I std :: move from something onto the stack to another object, can another object still be used when the original goes out of scope?
#include <iostream> #include <string> int main(int argc, char* argv[]) { std::string outer_scope; { std::string inner_scope = "candy"; outer_scope = std::move(inner_scope); } std::cout << outer_scope << std::endl; return 0; }
Is outer_scope still valid when I try to print it?
source share