メンバーがパラメータの所有権を取得するという問題に対する2つの合理的な解決策があります。
Foo::Foo(std::unique_ptr<int> parameter)
: member(std::move(parameter))
{
}
Bar::Bar(std::unique_ptr<int> parameter)
{
member.swap(parameter);
}
これらのうち、慣用的で、理解しやすく、デバッグしやすく、保守しやすいものはどれですか?
私が見逃した問題に対する追加の解決策はありますか?