[intrusive] unordered_set insert/find question

hi all, i am a bit confused about the behavior of boost::intrusive::unordered_set. i can insert() an object, but i am unable to find() it: my basic workflow is: // insert: map_type * elem = new map_type(); std::pair<iterator, bool> inserted = slot_resolver_map.insert(*elem); bool success = inserted.second; assert(success); // object has been inserted correctly // verify: iterator this_iterator = inserted.first; iterator found = slot_resolver_map.find(*elem); iterator end = slot_resolver_map.end(); assert(this_iterator == found); // fails assert(found != end); // fails so basically if i insert an element, i cannot find it anymore ... i have a reduced test case, which shows this behavior at [1] ... is this my fault (not using the unordered_set correctly) or is it a bug in boost.intrusive? thanks, tim

On 15 June 2011 09:22, Tim Blechmann <tim@klingt.org> wrote:
i have a reduced test case, which shows this behavior at [1] ... is this my fault (not using the unordered_set correctly) or is it a bug in boost.intrusive?
I think you forgot to include the link/attachment for '[1]'. I don't know boost.intrusive very well, but you seem to be searching for the element rather than the key, is it possible that there's an implicit conversion from the element to the key, and you're searching on that?

i have a reduced test case, which shows this behavior at [1] ... is this my fault (not using the unordered_set correctly) or is it a bug in boost.intrusive?
I think you forgot to include the link/attachment for '[1]'.
oops ... http://pastebin.com/KNXhuSiH
I don't know boost.intrusive very well, but you seem to be searching for the element rather than the key, is it possible that there's an implicit conversion from the element to the key, and you're searching on that?
i am inserting an element to the set, then i search for the element. i don't see how an implicit conversion could happen. thanks, tim

i am a bit confused about the behavior of boost::intrusive::unordered_set. i can
insert() an object, but i am unable to find() it: Can you send me the testcase? It will surely be a bug,
daniel already pointed me to the bug in my code ... pretty stupid user bug ... sry for the noise ... tim
participants (3)
-
Daniel James
-
Ion Gaztañaga
-
Tim Blechmann