On Sat, Jun 30, 2012 at 6:27 AM, bearophile <span dir="ltr"><<a href="mailto:bearophileHUGS@lycos.com" target="_blank">bearophileHUGS@lycos.com</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Tobias Pankrath:<div class="im"><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
But I would generally avoid SList.<br>
</blockquote>
<br></div>
It's not good.<br>
<br>
And in general linked lists are quite overrated. On modern CPUs it's not easy to find situations where a linked list is better than a dynamic array or a chunked array (that is a dynamic array of pointers to arrays. It's often used to implement deques, etc).<br>

<br>
<br>
Regarding arrays, maybe a StableVector will be good to have in Phobos:<br>
<a href="http://www.boost.org/doc/libs/1_50_0_beta1/doc/html/container/non_standard_containers.html#container.non_standard_containers.stable_vector" target="_blank">http://www.boost.org/doc/libs/<u></u>1_50_0_beta1/doc/html/<u></u>container/non_standard_<u></u>containers.html#container.non_<u></u>standard_containers.stable_<u></u>vector</a><br>

<br>
Bye,<br>
bearophile<br>
</blockquote></div><br><div>I also think flat_map/_set from that same boost library would be great additions when the time comes to add new stuff to std.container.  Red black trees are kind of a niche container[1].  I replaced almost all of my usage of C++'s std::set and std::map with flat_map and flat_set and saw better memory use and far fewer cache misses (assuming I was reading the profiler correctly).  It was win-win since I rarely needed std::set/::map's exclusive features (iterator stability, log N insertions).  I believe I've read Andrei added something just like these to Loki.</div>
<div><br></div><div><br></div><div>[1] <a href="http://lafstern.org/matt/col1.pdf">http://lafstern.org/matt/col1.pdf</a> : Why you shouldn't use set (and what you should use instead)</div><div><br></div><div>Regards,</div>
<div>Brad Anderson</div>