【发布时间】:2012-04-24 06:36:23
【问题描述】:
概要
当类使用多重继承时,如何安全地设计移动构造函数?
详情
考虑以下场景:
struct T { };
struct U { };
struct X : public T, public U
{
X(X&& other)
: T(std::move(other))
, U(std::move(other)) // already moved?!
{
}
};
有没有办法安全地移动构造T 和U?
【问题讨论】:
标签: c++ c++11 multiple-inheritance move-semantics move-constructor