Re:Don’t blindly prefer emplace_back to push_back
by xKingfisher on Thursday March 04, 2021 @05:20AM
(#26340724)
Given the whole scanf/strlen thing going on, more blog posts about API pitfalls wouldn't necessarily be a bad thing.
And that is basically the premise of the Abseil Tip of the week series, which are an incredible resource for learning how to work with modern C++.
But okay, maybe it's more obvious when having worked with pre-C++11 code, where you would have killed for something like emplace_back. If you are new to the language and only know modern C++, you probably don't think much about why emplace_back exists in addition to push_back, and why it can be faster.