alias type reduction

js.mdnq js_adddot+mdng at gmail.com
Fri Dec 14 22:55:50 PST 2012


On Friday, 14 December 2012 at 05:54:33 UTC, Philippe Sigaud 
wrote:
>>
>>
>> Ok, I'll try again. when I was doing it I would get circular 
>> referencing
>> but maybe I did something wrong...
>>
>
> Another possibility is to use `.A`: the (.) prefix means the 
> symbol is
> looked in the external scope, not inside the template. So the 
> 2-params A is
> found.
>
> template A(T)
> {
>   alias .A!(T, true) A;
> }

I guess I'm being dense, I can't seem to get any of the 
"solutions" to work.


If you don't mind, could you see if your solutions work on the 
following code:

http://dpaste.dzfl.pl/64025e0a

What I'm trying to do is "hide" the _NestLevel argument of the 
template(it should always be true).

I can use alias directly as long as the class name is "mangled" 
but when I try to use templates I can't seem to get it to work.

This is possibly because I want to design the code to work with a 
variable number of arguments(hence my asking for the number of 
arguments of a templated class in the other post).

e.g., I want

class A(..., bool _NestLevel = true) { }

then

A(...) a; to create an object. (note the _NestLevel is "hidden")

If A has only one template argument, _NestLevel, then I want this 
to reduce to

A a;

Thanks.


More information about the Digitalmars-d-learn mailing list