IsValueType template? std.traits.hasAliasing?

Bill Baxter wbaxter at gmail.com
Tue Jan 27 17:44:28 PST 2009


Does anyone have a good template for checking if a struct is
semantically a pure value type or not?
I found "hasAliasing" in D2 which is close, but it seems to report
true even for static arrays.

struct X { float[3] vals; }
pragma(msg, hasAliasing!(X)?"true":"false"); --> true

Maybe that's just a bug in hasAliasing?

What I want to know is if     X=Y will give me an X that is
independent of Y.  I think that is the same question hasAliasing is
trying to answer.  If so then it's a bug.

--bb



More information about the Digitalmars-d mailing list