Unexpected type names with template typedefs
BCS
ao at pathlink.com
Mon Apr 28 20:45:18 PDT 2008
Reply to Simen,
> struct foo(T)
> {
> T value;
> }
> template bar(T)
> {
> typedef foo!(T) bar;
> }
> void main(string[] args)
> {
> writefln((bar!(int)).stringof); // prints 'bar'
> writefln((bar!(float)).stringof); // prints 'bar'
> writefln((bar!(bar!(int))).stringof); // prints 'bar'
> writefln((foo!(int)).stringof); // prints 'foo!(int)'
> writefln((foo!(float)).stringof); // prints 'foo!(float)'
> writefln((foo!(foo!(int))).stringof); // prints 'foo!(foo!(int))'
> }
> Should not the output of the first three be 'bar!(int)',
> 'bar!(float)', and 'bar!(bar!(int))'?
>
you might be getting a smaller case than what you want, namely the typedef
rater than the name of the template. this might be be related to fully qualified
names and such.
More information about the Digitalmars-d-learn
mailing list