
15 Feb
2012
15 Feb
'12
7:18 p.m.
AMDG On 02/15/2012 10:52 AM, Frank Birbacher wrote:
I've come across lots of code that uses std::set where I think a sorted vector would perform better. Those places a characterized by: 1. fills the set only once, 2. just wants to drop duplicates or 3. calls set::find very often. Facing such code I often wished there was a ready to use sorted_vector implementation.
I think a new container that stores elements in a vector instead of a tree offers strong advantages: a. one call to std::sort instead of managing a red-black-tree b. less memory overhead c. better data locality for lookup
Have you seen boost::container::flat_set? In Christ, Steven Watanabe