Protocols vs Concepts?

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Thu Nov 21 08:02:33 PST 2013


On 11/20/13 11:50 PM, Jacob Carlborg wrote:
> I guess his suggestion would be something like this:
>
> interface InputRange (R)
> {
>      @property bool empty ();
>      void popFront ();
>      ElementType!(R) front ();
> }
>
> void foo (R) (R r) if(implements!(InputRange!(R)))

Interfaces can't check for a variety of things that Boolean conditions 
can (isInfinite comes to mind).

Andrei



More information about the Digitalmars-d mailing list