Issue 47 in google-sparsehash: Feature request: get deleted_key and empty_key

1 view
Skip to first unread message

google-s...@googlecode.com

unread,
Dec 11, 2009, 1:06:14 PM12/11/09
to google-s...@googlegroups.com
Status: New
Owner: ----

New issue 47 by sjackman: Feature request: get deleted_key and empty_key
http://code.google.com/p/google-sparsehash/issues/detail?id=47

Implement accessors for deleted and empty_key.

--
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings

google-s...@googlecode.com

unread,
Dec 11, 2009, 5:03:06 PM12/11/09
to google-s...@googlegroups.com
Updates:
Labels: Type-Enhancement Priority-Medium

Comment #1 on issue 47 by csilvers: Feature request: get deleted_key and
empty_key
http://code.google.com/p/google-sparsehash/issues/detail?id=47

Shaun has offered to write up a patch. Yay!

Shaun, can you also (e)sign the contributor license at
http://code.google.com/legal/individual-cla-v1.0.html
?

Thanks,
craig

google-s...@googlecode.com

unread,
Dec 31, 2009, 3:46:54 PM12/31/09
to google-s...@googlegroups.com

Comment #2 on issue 47 by sjackman: Feature request: get deleted_key and
empty_key
http://code.google.com/p/google-sparsehash/issues/detail?id=47

Hi Craig,

Attached is a patch to implement deleted_key and empty_key. I've added a
very simple
unit test to make sure that all six cases at least compile. I haven't yet
added
documentation.

On Dec 9, 6:07 pm, Craig Silverstein <csilv...@google.com> wrote:
...
> I guess we'll have to figure out reasonable answers for these to give
> when the deleted key and empty key haven't been set yet.

I'm asserting that use_deleted or use_empty are true, which is a nice simple
solution. Another possibility is to return
pair<key_type, bool>(delkey, use_deleted)

Cheers,
Shaun

2009-12-31 Shaun Jackman <sjac...@gmail.com>

* google/sparsehash/densehashtable.h (empty_key, deleted_key): New
function.
* google/dense_hash_map: Ditto.
* google/dense_hash_set: Ditto.
* google/sparsehash/sparsehashtable.h (deleted_key): New function.
* google/sparse_hash_map: Ditto.
* google/sparse_hash_set: Ditto.
* hashtable_unittest.cc (test_int, TestOperatorEquals): Add unit tests.


Attachments:
get_deleted_key.diff 6.6 KB

google-s...@googlecode.com

unread,
Jan 4, 2010, 4:35:23 PM1/4/10
to google-s...@googlegroups.com
Updates:
Status: Started

Comment #3 on issue 47 by csilvers: Feature request: get deleted_key and
empty_key
http://code.google.com/p/google-sparsehash/issues/detail?id=47

Thanks for the patch! I applied it successfully and tested it, and all
looks good. I
made a few minor changes: mostly formatting, but also making the new
methods const in
the wrapper classes (they were already const in foohashtable.h, but not in
foo_hash_{map,set}).

I'll have one more pair of eyes look it over here, and assuming all goes
well, it will
be in the next release.

google-s...@googlecode.com

unread,
Jan 4, 2010, 4:46:45 PM1/4/10
to google-s...@googlegroups.com

Comment #4 on issue 47 by csilvers: Feature request: get deleted_key and
empty_key
http://code.google.com/p/google-sparsehash/issues/detail?id=47

One more thing: can you provide a patch to the doc files, to document these
new
methods, in the appropriate places (if any)? I haven't looked yet to see
where they
might best fit.

google-s...@googlecode.com

unread,
Jan 4, 2010, 4:53:51 PM1/4/10
to google-s...@googlegroups.com

Comment #5 on issue 47 by sjackman: Feature request: get deleted_key and
empty_key
http://code.google.com/p/google-sparsehash/issues/detail?id=47

Thanks for catching the const-ness. I missed that. Are you happy with the
assert(use_deleted)? I'll work on documentation next.

Cheers,
Shaun

google-s...@googlecode.com

unread,
Jan 4, 2010, 8:53:04 PM1/4/10
to google-s...@googlegroups.com

Comment #6 on issue 47 by csilvers: Feature request: get deleted_key and
empty_key
http://code.google.com/p/google-sparsehash/issues/detail?id=47

Yes, I think the asserts are fine -- we get to decide the semantics of these
functions, which is always nice. :-) Just be sure to document that it's
illegal to
call foo_key before set_foo_key.

google-s...@googlecode.com

unread,
Jan 11, 2010, 7:13:50 PM1/11/10
to google-s...@googlegroups.com
Updates:
Status: Fixed

Comment #7 on issue 47 by csilvers: Feature request: get deleted_key and
empty_key
http://code.google.com/p/google-sparsehash/issues/detail?id=47

This should be resolved in sparsehash 1.6, just released.

Reply all
Reply to author
Forward
0 new messages