On Tuesday, 12 March 2013 at 02:39:06 UTC, TommiT wrote:
struct S1 implements A2 {
    void foo() { }
    void bar() { }
}

That's not good. Types shouldn't have to explicitly say that they implement a concept. The fact that a type implements a concept should be implicit, i.e. the following (pseudo-code) should work:

concept InputRange {
    if( is(typeof(this.empty) : bool)
    &&  is(typeof(this.front))
    &&  is(typeof(this.popFront() == void) )
}

struct MyRange {
    bool empty() { return false; }
    int  front() { return 42; }
    void popFront() { }
}

void main() {
    static assert(is(MyRange == InputRange));
}

Reply via email to