How I can determine this is class or struct at compile time?

Bill Baxter wbaxter at gmail.com
Sat Dec 27 01:37:11 PST 2008


On Sat, Dec 27, 2008 at 4:14 PM, BCS <ao at pathlink.com> wrote:
> Reply to Weed,
>
>> subj
>>
>
> is(typeof(*this))?"struct":"class"; // untested
>
>
>

if (is(typeof(this) == class)) {
    // is class
} else {
    //not
}


This page is your friend:
http://www.digitalmars.com/d/1.0/expression.html#IsExpression
Keep a copy under your pillow.

--bb


More information about the Digitalmars-d-learn mailing list