内部にサブクラスまたは構造を持つクラスの場合、それをリセットする最もエレガントな方法は何ですか?
class attributes {
public:
std::string address;
short port;
std::vector< std::string > data;
struct Foo foo;
};
ループの中で最もエレガントなものは何ですか? デフォルトの演算子 = 構造体を記憶する Reset メソッドを作成しますmemset(...)
か?
attributes obj, originalStateToResetObj;
for(;;)
//do stuff with obj
obj.address = "172.0.0.1"
//etc
//reseting obj using operator=
obj = originalStateToResetObj;
// OR using Reset?
obj.Reset();
}
他のエレガントな提案は?