How to tell how an object/class is declared

Meta via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Nov 6 15:43:16 PST 2014


Say I have the following struct and object definitions:

struct Test1(T)
{
     static if (???)
     {
         void doSomething()
         {
             writeln(typeof(this).stringof);
         }
     }

     T t;
}

class Test2(T)
{
     static if (???)
     {
         void doSomething()
         {
             writeln(typeof(this).stringof);
         }
     }

     T t;
}

const(Test1!int) t1i;
shared(Test2!int) t2s;

How can I tell at the points marked in the above code if the 
class or struct instance was declared as const, shared, etc.? Is 
this possible?


More information about the Digitalmars-d-learn mailing list