constraints,template specialization,drop IFTI

Jarrett Billingsley jarrett.billingsley at gmail.com
Wed Jul 15 10:18:15 PDT 2009


On Wed, Jul 15, 2009 at 12:30 PM, BLS<windevguy at hotmail.de> wrote:
> I have somehow the idea that D constraints and template specialization
> should merge.
> Guess what I want to say is that instead of accepting the  compiler decision
> for template specialization  a constraints could be used for : "I am not the
> one who is able to fulfill your needs.. try this template instead."
>
> template Foo(int N)
>        if ( ( N & 1 _else_ FooOdd!(int N)) )
> {
>    ...
> }

I'm not sure why you'd need that..

template Foo(int N) if(N & 1) {
    // odd
}

template Foo(int N) {
    // even
}



More information about the Digitalmars-d mailing list