class Foo
{
public:
Foo(){
cout << "Foo::Foo" << endl;
}
~Foo(){
cout << "Foo::~Foo" << endl;
}
Foo(const Foo& rhs) {
cout << "Foo::Foo(const Foo& rhs)" << endl;
}
Foo& operator=(const Foo& rhs) {
cout << "Foo::operator=(const Foo& rhs)" << endl;
return *this;
}
};
int main()
{
{
std::vector<Foo> fooList;
fooList.reserve(100);
cout << "--- 1 ---" << endl;
fooList.push_back(Foo());
cout << "--- 2 ---" << endl;
fooList.push_back(Foo());
cout << "--- 3 ---" << endl;
fooList.push_back(Foo());
cout << "--- 4 ---" << endl;
fooList.push_back(Foo());
cout << "--- 5 ---" << endl;
fooList.push_back(Foo());
cout << "--- 6 ---" << endl;
fooList.push_back(Foo());
cout << "--- 7 ---" << endl;
fooList.push_back(Foo());
cout << "--- 8 ---" << endl;
}
}