私のコードの非常に単純化されたバージョンは次のとおりです。
class bCls {
private:
/// Many members, not shown for simplicity.
public:
/// Custom assignment operator; I would like to use the default operator within.
bCls& operator=(bCls&& rhs) {
defaultoperator=(rhs);
someCustomOperations();
return *this;
}
};
defaultoperator=(bCls&&) の代わりにデフォルトの代入演算子を使用するエレガントなソリューションはありますか? 私は、bCls の補助クラスまたは基本クラスに頼りたくありません。また、明らかに、メンバーごとに割り当てを行いたくありません。基本クラスまたはネストされたクラスが唯一の可能な解決策ですか? コードを読みやすくするソリューションを期待しています。