A Briefer Syntax for Using Concepts

froglegs via Digitalmars-d digitalmars-d at puremagic.com
Wed May 7 13:47:55 PDT 2014


  I believe Concepts lite in C++ works around this by allowing a 
syntax like this:

void foo(InputRange{T} range1, InputRange{T2} range2)

vs.

void foo(InputRange range1, InputRange range2)

If they are the same type.


> I believe the objection is that the proposed syntax can't tell 
> the
> difference between:
>
> 	void foo(R)(R range1, R range2) if (isInputRange!R)
>
> and
>
> 	void foo(R,S)(R range1, S range2) if (isInputRange!R && 
> isInputRange!S)
>
> I.e. in the first case, the two ranges must be the same type, 
> whereas in
> the second case they can be different types as long as they are 
> both
> input ranges.
>
>
> T



More information about the Digitalmars-d mailing list