The following code yields results as commented.

import std.stdio;

class A
{
        int b;
}

void main()
{
        const A a = new A;
        writeln(typeof(a).stringof); // const(A)
        writeln(typeof(a.b).stringof); // const(int)

        writeln((const A).stringof); // const(A)
        writeln(typeof((const A).b).stringof); // int
}

Given this information, how do I work around this in templates? I'd like a
template which can type its params based on members of T, for instance:

void foo(T)(T x, typeof(T.member) y)

but this will yield non-const second parameters even if T is const. Help 
anybody?

Reply via email to