# include <iostream> # include <vector> using namespace std; struct Obj { Obj() { cout << "constructor" << endl; } Obj(const Obj& o) { cout << "copy constructor" << endl; } /* ムーブコンストラクタなしの場合 Obj(Obj&& o) { cout << "move constructor" << endl; } */ }; int main() { std::vector<Obj> v; cout << "1\n"; v.push_back(Obj()); cout << "2\n"; v.push_back(Obj()); cout << "3\n"; v.push_back(Obj()); return 0; }
