Could we reserve void[T] for builtin set of T ?

Jacob Carlborg via Digitalmars-d digitalmars-d at puremagic.com
Sat Apr 2 03:26:27 PDT 2016


On 2016-03-31 21:57, Walter Bright wrote:
> On 3/31/2016 12:44 PM, H. S. Teoh via Digitalmars-d wrote:
>> Ah, makes sense.  But what would aa[x] return?
>
> A bool indicating membership.
>
>> And how would you add elements to it?
>
> aa[x] = true;  // add member x
> aa[x] = false; // remove member x
> x in aa; // compile error

Looks really weird to me. I was thinking something like this:

void[int] set;

set ~= 3;
set ~= 4;
set.remove(3);
bool present = 4 in set; // returns a bool and not a pointer

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list