Interfaces, traits, concepts, and my idea for a DIP

cym13 via Digitalmars-d digitalmars-d at puremagic.com
Fri Jul 31 04:32:57 PDT 2015


On Friday, 31 July 2015 at 11:16:48 UTC, Biotronic wrote:
> Why are there two different things in the first place?
>
> @satisfies!(myConcept, T) should test the constraints and give 
> a sensible error message. This you use to indicate that type T 
> implements myConcept.
>
> Why can't another template use the very same concept 
> information to check if a type implements the concept?
>
> e.g.:
>
> @satisfies!(myConcept, MyStruct)
> struct MyStruct { /* ... */ }
>
> void foo(T)(T t) if (check!(myConcept, T))
> { /* ... */ }

That would be better !


More information about the Digitalmars-d mailing list