Different class template args to generate same template instance?
downs
default_357-line at yahoo.de
Mon Nov 2 13:36:03 PST 2009
Nick Sabalausky wrote:
> "BCS" <none at anon.com> wrote in message
> news:a6268ffc3898cc29d1f554dfe2 at news.digitalmars.com...
>> Hello Nick,
>>
>>
>>> So...is there any trickery I
>>> could do so that SubFoo!("sam") and SubFoo!("sam", "human") would
>>> resolve to the same subclass of Foo?
>> Make a SubFoo!(char[] s) that does your logic and if it passesa alises to
>> SubFoo!(s,"")
>>
>>
>
> I'm not sure I understand...?
>
>
I think what he's trying to say is
template SubFoo!(char[] name, char[] type) {
static if (name == "sam" && (type == "human" || type == "")) alias _SubFoo!("sam", "human") SubFoo;
/* etc */
}
More information about the Digitalmars-d-learn
mailing list