epitzer / sparsehash

Automatically exported from code.google.com/p/sparsehash
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Assertion failed: !use_empty || !equals(get_key(obj), get_key(emptyval)), file densehashtable.h, line 76 4 #31

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Compile the attached source file.
2.
3.

What is the expected output? What do you see instead?
Assertion failed: !use_empty || !equals(get_key(obj), get_key(emptyval)),
file densehashtable.h, line 764

What version of the product are you using? On what operating system?

Please provide any additional information below.
I use the set_empty_key but i still get an error, different the error given
when not using set_empty_key. 

Thanks

Original issue reported on code.google.com by ory...@gmail.com on 27 Feb 2009 at 6:39

Attachments:

GoogleCodeExporter commented 8 years ago
Wow, this sample program is broken in so many ways.  However, the brokenness 
that
causes this particular assertion failure, is that you've declared every sample 
to be
equal to every other.  This means when you insert n, you are inserting an item 
that
is "equal" to the empty key, which is not allowed by the dense_hash_set API.

Original comment by csilv...@gmail.com on 27 Feb 2009 at 6:59

GoogleCodeExporter commented 8 years ago
Ok, so the assertion comes from my hash function and equal operator that are not
really define. By adding suitable hash and operator, it works. Thanks a lot.

Original comment by ory...@gmail.com on 27 Feb 2009 at 7:07