News for hackers. Stuff that matters.
Re:Don’t blindly prefer emplace_back to push_back by quietbritishjim on Thursday March 04, 2021 @05:46AM (#26340881)
I used one the other day because it had the interface I needed and the number of items was so small and so infrequently iterated over that performance didn't matter. (I guess that's not really what you meant though: you were probably interested in a use where it really was needed for performance reasons - splicing things around or the like.)

Specifically I needed the guarantee that iterators weren't invalidated by other parts of the list changing. I could've used a vector and worked around it but it would've taken more effort and more code, and like I said the performance difference wouldn't have made an overall difference to the program.

There are no comments on this comment yet.