deleted_key?

63 views
Skip to first unread message

Gregory Popovitch

unread,
May 24, 2016, 6:11:32 PM5/24/16
to google-sparsehash
I wonder why "set_deleted_key()" is needed for the sparse_hash_table. After all the bitmap clearly defines which entries are occupied. Is there any special reason for this to be present?

Thanks!

philip...@gmail.com

unread,
May 29, 2016, 8:51:24 AM5/29/16
to google-sparsehash
Please consider posting @ https://github.com/sparsehash/sparsehash/issues

set_deleted_key only needs to be called AFAIK if you ever call "erase".

Gregory Popovitch

unread,
May 29, 2016, 2:29:03 PM5/29/16
to google-sparsehash, philip...@gmail.com
Thanks for the answer, Philip, I was starting to think this group was dead. I realized that the main purpose of set_deleted_key() was to allow to erase elements without invalidating iterators. It would not be that useful if erase() was to return an iterator to the next element as specified for unordered_hash(). 

 

Gregory Popovitch

unread,
Jun 9, 2016, 6:31:43 PM6/9/16
to google-sparsehash, philip...@gmail.com

Duh, answering myself here, if we just toggle the bitmap bit off when calling erase(), further lookups for keys which have the same hash as this entry will fail.
Reply all
Reply to author
Forward
0 new messages