Implicit template properties

Edward Diener eddielee_no_spam_here at tropicsoft.com
Sun Apr 13 05:02:23 PDT 2008


In the documentation on templates I read:

"Implicit Template Properties
If a template has exactly one member in it, and the name of that member 
is the same as the template name, that member is assumed to be referred 
to in a template instantiation:
template Foo(T)
{
T Foo; // declare variable Foo of type T
}
void test()
{
Foo!(int) = 6; // instead of Foo!(int).Foo
}"

What practical benefit does it serve having a template with a single 
member which has the same name as the template itself ? It does not 
appear that one can do anything with such a template.



More information about the Digitalmars-d mailing list