emplace vs push_back code example
Example: emplace_back
// vector::emplace_back
#include <iostream>
#include <vector>
int main ()
{
std::vector<int> myvector = {10,20,30};
myvector.emplace_back (100);
myvector.emplace_back (200);
std::cout << "myvector contains:";
for (auto& x: myvector)
std::cout << ' ' << x;
std::cout << '\n';
return 0;
}