Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
私たちのコードには class と言うクラスがありCます。class のオブジェクトのベクトルを作成したいと思いますC。ただし、コピー コンストラクターと代入演算子の両方が、意図的に と宣言されていますprivate。私はそれを変更したくありません (そしておそらく許可されていません)。
C
private
を使用/定義する他のクリーンな方法はありますvector<C>か?
vector<C>
代わりにvector<C*>orを使用できます。vector<shared_ptr<C>>
vector<C*>
vector<shared_ptr<C>>
ブースト ライブラリにアクセスできますか?
ブースト共有ポインターのベクトルを作成します。
std::vector<boost:shared_ptr<C>>