【发布时间】:2011-07-28 20:07:31
【问题描述】:
只是为了确保很好地理解引擎盖下的内容......问题在代码中作为 cmets
void test(int && val)
{
val=4;
}//val is destroyed here ?
int main()
{
int nb;
test(std::move(nb));
//undefined behavior if I reference here nb ?
std::cout << nb;
nb=5;
std::cin.ignore();
}
【问题讨论】:
标签: c++ c++11 move-semantics