Custom hash table key is const, how to call dtors?

Marco Leise via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Feb 5 19:57:16 PST 2016


Am Sat, 06 Feb 2016 03:38:54 +0000
schrieb cy <dlang at verge.info.tm>:

> On Friday, 5 February 2016 at 22:18:50 UTC, Marco Leise wrote:
> > But when you remove items from the table you need to call a 
> > const/immutable dtor that needs to be written for everything 
> > that can be a hash table key.
> 
> You need to write destructors for hash keys? How would you use 
> string literals as keys then? Could you provide an example 
> maybe...?

No, but they could have dtors because they contain malloc'd
data. E.g. string literals that don't live on the GC heap.

-- 
Marco



More information about the Digitalmars-d-learn mailing list