I think this is fine to go in. I don't want to block further work on the actual non-determinism. What follows is speculation about future work here:<div><br></div><div>I'm still not convinced we want to expose the actual DenseMap iteration ever. I see three options that I think I like better:</div>
<div><br></div><div>1) Don't expose map-style iteration of the keys and values at all.</div><div>2) Store vector<pair<const KeyT, ValueT>> as the vector storage, and make the densemap not even contain the keys.</div>
<div>3) Provide a method on MapVector that returns a vector<pair<const KeyT, ValueT>> by value, creating it on demand by inserting into a new vector at the position of the value in the storage vector.</div><div>
<br></div><div>#1 is my favorite, but I'd really have to study the use case(s) you have to understand if they could be reformulated to work in that model. Might be worth doing eventually just to understand the requirements.</div>
<div><br></div><div>#2 is appealing in interesting ways. While slower than a traditional DenseMap, it would have none of the traditional limitations. The DenseMap could actually be DensMap<unsigned, unsigned> where the key is the hash_code converted to an unsigned, and the value is the index. It also provides a natural way to support the pair-based value_type interface points. However, it would have strictly worse locality than your solution or #1.</div>
<div><br></div><div>#3 is really just a hack to get the locality of #1 with the interface of #2, and consequentially making the interface of #2 very costly to use.</div><div><br></div><div><br></div><div>Once these issues are sorted out (however they are sorted out) we should add MapVector to the programmer's guide.</div>
<div><br></div><div>-Chandler</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Sep 18, 2012 at 8:39 AM, Rafael EspĂ­ndola <span dir="ltr"><<a href="mailto:rafael.espindola@gmail.com" target="_blank">rafael.espindola@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">> DenseMapInfo only lets me select the key, not values. The value are<br>
> just default constructed, so I created a wrapper class.<br>
<br>
</div>On a discussion on IRC Chandler suggested using insert. The attached<br>
patch does that.<br>
<br>
Cheers,<br>
Rafael<br>
</blockquote></div><br></div>