Is my T.init elaborate (eg: Not "0")

monarch_dodra via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon May 5 23:03:07 PDT 2014


On Monday, 5 May 2014 at 21:54:33 UTC, Tobias Pankrath wrote:
> On Monday, 5 May 2014 at 21:51:14 UTC, Tobias Pankrath wrote
>>> I'm trying to find the same result, without a runtime check. 
>>> Anybody know how? I'd write a function that tests the bits of 
>>> a T.init copy, but reinterpreting is not allowed during 
>>> CTFE...
>>
>> Foreach member x of Type X of T, check if T.init.x equals 
>> X.init?
>
> Ah, sorry, didn't read carefully. This is not what you want.

Actually, I think you're on to something. I can recursively 
iterate on all basic types in my T, and check they are all "0" or 
NULL. Should work.

Thanks!


More information about the Digitalmars-d-learn mailing list