Allow implicit template properties for templates with more than one member
Daniel Keep
daniel.keep+lists at gmail.com
Sat Dec 23 15:47:28 PST 2006
Frits van Bommel wrote:
> 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:
>
>
> This has been proposed before, but (IIRC) with the added qualification
> that all other members should be private for it to work. Still hasn't
> happened though :(.
Mmm; I agree with the extra restriction: the implicit property works iff
the template has exactly one public member with the same name as the
template itself.
-- Daniel
More information about the Digitalmars-d
mailing list