How to test for type without refs?

Charles Hixson via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Mar 17 07:05:19 PDT 2015


I thought that in:
     T* user(T)()
     {    static assert (T.sizeof < bfHdr.user_.length);
           static assert (__traits(isPOD, T) );
           return    cast(T*) bfHdr.user_.ptr;
     }
the line:
static assert (__traits(isPOD, T) );

would test for there not being any embedded refs, pointers, etc., but
unittest
{
...
     struct    thead2    {    string    test;    }
     auto    userTest2    =    bf.user!(thead2)();
}
executes without complaint.  Is there a better way?


More information about the Digitalmars-d-learn mailing list