digitalmars.D.learn - How I can determine this is class or struct at compile time?
- Weed (1/1) Dec 26 2008 subj
- BCS (2/4) Dec 26 2008 is(typeof(*this))?"struct":"class"; // untested
- Bill Baxter (10/14) Dec 27 2008 if (is(typeof(this) == class)) {
- BCS (2/21) Dec 27 2008 Um... Doh... that what I get for working to late at night.
Reply to Weed,subjis(typeof(*this))?"struct":"class"; // untested
Dec 26 2008
On Sat, Dec 27, 2008 at 4:14 PM, BCS <ao pathlink.com> wrote:Reply to Weed,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. --bbsubjis(typeof(*this))?"struct":"class"; // untested
Dec 27 2008
Reply to Bill,On Sat, Dec 27, 2008 at 4:14 PM, BCS <ao pathlink.com> wrote:Um... Doh... that what I get for working to late at night.Reply to Weed,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. --bbsubjis(typeof(*this))?"struct":"class"; // untested
Dec 27 2008