constraints,template specialization,drop IFTI
BLS
windevguy at hotmail.de
Wed Jul 15 10:42:10 PDT 2009
Jarrett Billingsley wrote:
> 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..
>
Quote : "
Constraints are not involved with determining which template is more
specialized than another. "
> template Foo(int N) if(N & 1) {
> // odd
> }
>
> template Foo(int N) {
> // even
> }
//programmer's control
template Foo(T : Tuple)
match T { case... }
{
//default
}
Better ?
--well maybe I am completely wrong
More information about the Digitalmars-d
mailing list