Re:Don’t blindly prefer emplace_back to push_back
by ncmncm on Thursday March 04, 2021 @11:01PM
(#26352514)
Nope, he's right. He maybe shouldn't be right, but certain convenience features are still missing from Standard Library components and the language that could someday make him wrong.
It is sometimes right to hold your nose and use std::piecewise_construct.
But most usually it doesn't matter, and worrying about it will distract you from what does matter. So, push_back() unless you know you have a good reason not to. And, you might never encounter one.
Good C++ and naïve C++ are not so different. Both are much better than fake-smart C++.
It is sometimes right to hold your nose and use std::piecewise_construct.
But most usually it doesn't matter, and worrying about it will distract you from what does matter. So, push_back() unless you know you have a good reason not to. And, you might never encounter one.
Good C++ and naïve C++ are not so different. Both are much better than fake-smart C++.