Protocols vs Concepts?

Dicebot public at dicebot.lv
Thu Nov 21 04:25:41 PST 2013


On Thursday, 21 November 2013 at 07:50:11 UTC, 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)))
>
> Personally I think it's nice to have a concrete type like this.

I perfectly understand his suggestion as I have implemented it 
already few times ;) Again - it is nice, but does not give you 
any real advantage unless can also be used with `wrap`.


More information about the Digitalmars-d mailing list