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

2016-02-06 Thread Marco Leise via Digitalmars-d-learn
Am Sun, 07 Feb 2016 01:05:28 + schrieb cy : > On Saturday, 6 February 2016 at 03:57:16 UTC, Marco Leise wrote: > > > No, but they could have dtors because they contain malloc'd > > data. E.g. string literals that don't live on the GC heap. > > Character arrays allocated with glibc malloc ar

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

2016-02-06 Thread cy via Digitalmars-d-learn
On Saturday, 6 February 2016 at 03:57:16 UTC, Marco Leise wrote: No, but they could have dtors because they contain malloc'd data. E.g. string literals that don't live on the GC heap. Character arrays allocated with glibc malloc are immutable? News to me...

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

2016-02-05 Thread Marco Leise via Digitalmars-d-learn
Am Sat, 06 Feb 2016 03:38:54 + schrieb cy : > 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 wri

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

2016-02-05 Thread cy via Digitalmars-d-learn
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

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

2016-02-05 Thread Marco Leise via Digitalmars-d-learn
Usually I want the keys to be declared "immutable" to signal that their content must not change in order to provide stable hashes. 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. What do you put