3 ms·
Passing a pointer doesn't always solve the problem. The idea behind std::piecewise_construct is to control the time at which the non-moveable object is construc
by pfitzen 3y ago
Passing a pointer doesn't always solve the problem.
The idea behind std::piecewise_construct is to control the
time at which the non-moveable object is constructed.
Simply passing a pointer means the object is created outside the container;
before the container is created. With std::emplace the container
is already (partially) created and gets control over creating
the objects it is going to contain. The container gets the power
to change the arguments to the constructor of its contained objects.