3 ms·
One way is to stack allocate it `foo temp_foo { 1, “bar” };`. Another is to ‘emplace’ straight into a container. When the container is deleted so are the obje
by gumby 7y ago
One way is to stack allocate it `foo temp_foo { 1, “bar” };`.
Another is to ‘emplace’ straight into a container. When the container is deleted so are the objects.
A third is to use `std::make_shared<foo>(1, “bar”)` or std::make_unique.