News for hackers. Stuff that matters.
Re:Don’t blindly prefer emplace_back to push_back by MaxBarraclough on Thursday March 04, 2021 @07:41AM (#26341591)
> I think this is said to express "simply replacing that function call/method/... without changing your calls/methods/coding style is not going to magically solve your problems"

I agree, but you're doing all the work in conjuring this interpretation. Saying it's not magic doesn't say anything substantial.

If it were possible to mechanically replace all references to push_back by emplace_back for an easy performance boost, then we wouldn't need emplace_back to be its own member function, it would just be a compiler optimisation. You have to make shallow and localised changes to make proper use of emplace_back, but isn't that the best we can hope for? Far easier than parallelism, say, where sweeping architectural changes may be necessary.

There are no comments on this comment yet.