#include <iostream>
#include <vector>
using namespace std;
class Obj
{
public:
Obj(int x, int y) : _x(x), _y(y)
{
}
int _x;
int _y;
};
int main()
{
std::vector<Obj> obj;
obj.emplace_back(10, 20);
std::cout << obj[0]._x << " " << obj[0]._y << std::endl;
obj[0]._x = 100;
std::cout << obj[0]._x << " " << obj[0]._y << std::endl;
std::vector<Obj> obj2;
obj2.reserve(1);
obj2[0] = Obj(30, 40);
std::cout << obj2[0]._x << " " << obj2[0]._y << std::endl;
obj2[0]._x = 100;
std::cout << obj2[0]._x << " " << obj2[0]._y << std::endl;
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8dmVjdG9yPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKY2xhc3MgT2JqCnsKcHVibGljOgoJT2JqKGludCB4LCBpbnQgeSkgOiBfeCh4KSwgX3koeSkKCXsKCQkKCX0KCQoJaW50IF94OwoJaW50IF95Owp9OwoKaW50IG1haW4oKSAKewoJc3RkOjp2ZWN0b3I8T2JqPiBvYmo7CglvYmouZW1wbGFjZV9iYWNrKDEwLCAyMCk7CglzdGQ6OmNvdXQgPDwgb2JqWzBdLl94IDw8ICIgIiA8PCBvYmpbMF0uX3kgPDwgc3RkOjplbmRsOwoJb2JqWzBdLl94ID0gMTAwOwoJc3RkOjpjb3V0IDw8IG9ialswXS5feCA8PCAiICIgPDwgb2JqWzBdLl95IDw8IHN0ZDo6ZW5kbDsKCQoJc3RkOjp2ZWN0b3I8T2JqPiBvYmoyOwoJb2JqMi5yZXNlcnZlKDEpOwoJb2JqMlswXSA9IE9iaigzMCwgNDApOwoJc3RkOjpjb3V0IDw8IG9iajJbMF0uX3ggPDwgIiAiIDw8IG9iajJbMF0uX3kgPDwgc3RkOjplbmRsOwoJb2JqMlswXS5feCA9IDEwMDsKCXN0ZDo6Y291dCA8PCBvYmoyWzBdLl94IDw8ICIgIiA8PCBvYmoyWzBdLl95IDw8IHN0ZDo6ZW5kbDsKCQoJcmV0dXJuIDA7Cn0=