Allow implicit template properties for templates with more than one member
Bill Baxter
dnewsgroup at billbaxter.com
Sat Dec 23 13:34:59 PST 2006
Jarrett Billingsley wrote:
> You can do this:
>
> template Foo()
> {
> const uint Foo = 5;
> }
>
> ...
>
> uint x = Foo!();
>
> And it automatically looks up Foo!().Foo because it has one member named the
> same as the template.
>
> What I'm suggesting is that the "have one member" part be changed. I've
> written and seen a lot of template code that does stuff like this:
Yes, this would be very nice to have.
I find myself wishing frequently I could do something like that when
dealing with non-trivial return/parameter types.
template something(T) {
alias [...] Ret;
alias [...] A;
alias [...] B;
Ret something(A a, B b) { ... }
}
Where the [...]'s are things like typeof(T.member) or other such
statically determined type based on T.
--bb
More information about the Digitalmars-d
mailing list