IsValueType template? std.traits.hasAliasing?

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Tue Jan 27 19:51:27 PST 2009


Bill Baxter wrote:
> 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

Yah, that's a bug. Could you please bugzillize it? I'm spent.

Andrei



More information about the Digitalmars-d mailing list