<div style="font-family: arial, helvetica, sans-serif"><font size="2"><div class="gmail_quote">On Wed, Jun 20, 2012 at 11:23 PM, Sean Silva <span dir="ltr"><<a href="mailto:silvas@purdue.edu" target="_blank">silvas@purdue.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Wow that got incredibly mangled somehow. it was meant to say:<div><br></div><div><span style="font-size:13px;font-family:arial,sans-serif">"Thank you Jakob for patiently </span><span style="font-size:13px;font-family:arial,sans-serif">walking me through my first non-trivial patch set! I'll see what I can do </span><span style="font-size:13px;font-family:arial,sans-serif">to ensure deterministic iteration order.</span><span style="font-size:13px;font-family:arial,sans-serif">"</span></div>

<div><span style="font-size:13px;font-family:arial,sans-serif"><br></span></div><div><span style="font-size:13px;font-family:arial,sans-serif">I'm still looking for a way to ensure deterministic iteration order without making a mess of the code, such as just blindly adding a special comparator to each of containers keyed on pointers; that would just make the code more muddled (even in cases where the container isn't being iterated over). There are also a couple hash tables that are keyed on Record*'s, which I think can be changed but I'm not familiar enough with the hash traits that they use. </span><span style="font-size:13px;font-family:arial,sans-serif">Any ideas for a good way to migrate to stable iteration interfaces? Thankfully, each Record has a field `unsigned ID;` which uniquely identifies it, so redirecting any hash/compare to that should be safe.</span></div>
</blockquote><div><br></div><div>I think introducing similar ID fields which are stable is the best strategy.</div><div><br></div><div>In particular, I like to dump the hashtable to a vector, and then sort on the stable key.</div>
<div><br></div><div>If you're lacking one of them, a common easy way to synthesize such an ID is to track order-of-allocation in the ID variable using a global atomic counter of some form. </div></div></font></div>