On 9/9/16, Mike Parker via Digitalmars-d-announce
<digitalmars-d-announce@puremagic.com> wrote:
> Wojciech Szęszoł has contributed a post describing his experience
> working on DStep for this year's GSoC. The post is at [1] and is
> on reddit at [2].

With regards to Sets missing from the language:

struct Set(T)
    void[0][T] set;  // void[0] should not allocate (according to
ancient manuscripts)
    alias set this;

    void put ( ) ( auto ref T input )
        this.set[input] = [];

void main ( )
    Set!int set;


    assert(1 in set);
    assert(5 in set);
    assert(4 !in set);

I'm not sure about any special syntax which is expected for languages
which have built-in sets. It would probably be overkill to add syntax
support, but I'm not sure how often people use set literals or not.

Reply via email to