Constraints & Concepts [Was: Re: C++0x news]
    bearophile 
    bearophileHUGS at lycos.com
       
    Mon Mar 15 09:40:01 PDT 2010
    
    
  
> typeof(P.sides[0]) perimeter(P)(const ref P poly) if (__traits(satisfiesConcept, perimeter, IsPolygon)) {
That's silly because the if() is called only when the template is instantiated, so this is a little better:
static assert(__traits(satisfiesConcept, perimeter, IsPolygon));
A problem left is that IsPolygon is not a list of things, currently it's a nested piece of D code for __traits(compiles).
Bye,
bearophile
    
    
More information about the Digitalmars-d
mailing list