March 05, 2007 Re: playing around with D | ||||
---|---|---|---|---|
| ||||
Daniel Keep Wrote:
>
> I can't see why it *should* work.
>
> The way I've always thought about it is that templates are parameterised namespaces. Since (/*alias*/ TC) is a type parameter, it makes no sense to pass in a namespace, whereas (alias TC) *does* since it's an alias to an arbitrary symbol.
>
> I dunno; maybe it's just my way of rationalising it :P
Your definitely right! - But I pass a TupleContainer to UseAppend - and TupleContainer is declared to be a struct. So it IS a type!
But your remark provokes a new question; given the following declaration:
template UseAppend( T )
{
alias T UseAppend;
}
What is UseAppend? Is it a named template (or a parametrised namespace) or is it an alias to a real type? - In some way it is both...
|
March 05, 2007 Re: playing around with D | ||||
---|---|---|---|---|
| ||||
Posted in reply to Carsten Scharfenberg | "Carsten Scharfenberg" <cathune_public@web.de> wrote in message news:eshgp4$28kp$1@digitalmars.com... > template UseAppend( T ) > { > alias T UseAppend; > } > > What is UseAppend? Is it a named template (or a parametrised namespace) or is it an alias to a real type? - In some way it is both.. UseAppend!(blah) is a template, and UseAppend!(blah).UseAppend is an alias to a real type. It's just that there's a bit of syntactic sugar that makes it so that UseAppend!(blah) will implicitly refer to its .UseAppend member. |
Copyright © 1999-2021 by the D Language Foundation