On 7 Mar 2015 at 10:06, Amarnath V A wrote:
Move construction of the map != move construction of the buckets.
Okay. I am trying to achieve move construction in the same spirit. And I am piggybacking on Niall's implementation of _rehash(). [snip] Is this the right direction?
It's better. Not there yet though. Keep going.
Old buckets go into a fixed size ring buffer, and get deleted eventually.
I couldn't really figure out where the ring buffer is which you are mentioning here. What am I missing?
_oldbuckets.
And another question, when I use the above implementation of move constructor and later call empty() on the newly created object, I land in a segfault. I see that the empy() checks on if the lock state is 2 and continues to check the next bucket. But, I think here I have all buckets set to lock state 2. Why did the swap I performed with the tempbuckets and oldmap._buckets not help me? Any pointers will be really helpful.
This is a good test of whether you have wrapped your head around the algorithm and fully understand how it works. Keep at it, you're getting closer. Niall -- ned Productions Limited Consulting http://www.nedproductions.biz/ http://ie.linkedin.com/in/nialldouglas/