News for hackers. Stuff that matters.
Re:Don’t blindly prefer emplace_back to push_back by jcelerier on Thursday March 04, 2021 @06:49AM (#26341268)
> When you have enough memory for the set of all elements you want to store but not enough contiguous memory for the set of all elements you want to store

That's only relevant if you don't have an MMU tho. So not on any desktop or embedded system where ram is measured in gigabytes.

Otherwise it's up to the OS to handle that - only individual memory pages are contiguous, but not sets of pages.

Re:Don’t blindly prefer emplace_back to push_back by saagarjha on Thursday March 04, 2021 @08:00AM (#26341769)
If your memory is fragmented enough you can have many pages that are lightly used, at which point a MMU isn't going to help.