Foo!("a").????? == `Foo!("a")`

Simen kjaeraas simen.kjaras at gmail.com
Sat Dec 5 22:11:39 PST 2009


On Sun, 06 Dec 2009 02:36:58 +0100, Nick Sabalausky <a at a.a> wrote:

> I don't suppose there's an easy general way to get the paramaters of a
> templated type just from the type itself? Ie, a way to get around this:
>
> class Foo(char[] str) {}
> static assert(Foo!("a").stringof != Foo!("b").stringof)
> // ^ fails because it evaluates to "Foo" != "Foo"
>
> I can probably work around it in my current case by sticking str into a
> const member of Foo and using that together with .stringof, but thought  
> I'd
> see if there was a better way.

Use more parentheses. ( Foo!( "a" ) ).stringof gives the right result. Of
course, this still seems rather weird.

-- 
Simen


More information about the Digitalmars-d-learn mailing list