3 ms·
Well of course that is going to leak, but you could instead do std::vector<Person> v; Person p(10); v.emplace_back(p); and be safe
by sbmassey 10y ago
Well of course that is going to leak, but you could instead do
std::vector<Person> v;
Person p(10);
v.emplace_back(p);
and be safe
- hellofunk 10y agoEmplacing an object that already exists misses the point of emplacement.