Re:Don’t blindly prefer emplace_back to push_back
by 4fips on Thursday March 04, 2021 @06:21AM
(#26341086)
Linked lists become really powerful and performant when implemented as intrusive containers, such containers do not need to live on heap and can be embedded directly into another data structures, so an element can be linked into multiple containers at the same time, this gives great flexibility and compactness (especially when indices are used to form the links instead of pointers).
[ Parent
| on HN ]
Re:Don’t blindly prefer emplace_back to push_back
by eru on Thursday March 04, 2021 @08:06AM
(#26341829)
Similarly, some data structure and algorithmic choices that don't make much sense when operating in RAM, can suddenly become appropriate in different environments.
Eg when working on hard disks (eg think a file system or database with raw storage access). Or if you are working in a medium were you can only write once, and can't change what's already written, etc.