How does the bookkeeping work for automatic variables?
{
std::string src1 = "hello world";
for (int i = 0; i < 10; i++)if (randint(0, 40) == 0) {
std::string src2 = std::relocate(src1);break;
}
// what if we use it here?
// std::cout << src1;
}
Is a flag or bool saved together with each automatic variable, which could be relocated?
The compiler would not be able to catch each usage after relocate in compile time.
However this is solved, a std::relocate call could be used without a new object. How does this work with the operator reloc syntax?