Need a collection of unique elements (like C++ std::set).

Cooler kulkin at hotbox.ru
Thu Jan 2 04:49:30 PST 2014


On Thursday, 2 January 2014 at 12:18:37 UTC, Andrej Mitrovic 
wrote:
> On 1/2/14, Cooler <kulkin at hotbox.ru> wrote:
>> Interesting... What is a profit of this solution over simple
>> bool[int]?
>
> AFAIK it will make the druntime hashes avoid allocating memory 
> for the
> value type, because:
>
> assert(bool.sizeof == 1);
> assert((void[0]).sizeof == 0);
>
> Note that void[0] is different from void[], as the latter is 
> really
> two size_t types in a struct.

As I understand any type can be used instead of void, because 
assert((bool[0]).sizeof == 0). Correct?


More information about the Digitalmars-d mailing list