【发布时间】:2014-12-22 03:13:01
【问题描述】:
考虑一个类:
class foo {
public:
foo(foo &&rhs) { /* some code */ }
~foo() noexcept { /* code that does destruction of owning objects */ }
private:
/* some non-trivial pointer graph like structure */
};
假设:
{
foo &f = get_from_other_class();
foo g = std::move(f);
// some time later f goes our of scope or the owning object is destroyed.
}
在std::move(f) 执行后,哪些后置条件适用于f?
注意
我怀疑f 必须仍然是完全可破坏的(不会破坏g 的拥有内容),但我没有在C++11 标准中找到相应的引用。我正在浏览 12.8 复制和移动类对象。
【问题讨论】:
标签: c++ c++11 language-lawyer