Object - part of the language, or part of Phobos?

Steve Teale steve.teale at britseyeview.com
Fri Sep 30 22:38:45 PDT 2011


module smem;

import std.stdio;

struct X
{
   int n;
   double d;
   char[] a;
}

void main()
{
   X x;
   TypeInfo typeinfo = typeid(x);                  // or typeid(x) for that matter
   writefln("%s", typeinfo);                           // smem.X
   OffsetTypeInfo[] tia = typeinfo.offTi();        // "Get type information on
the contents of the type; null if not available"
   writeln((tia is null)? "null": "");                 // null
   // Under what circumstances is the OffsetTypeInfo information available?
}


More information about the Digitalmars-d mailing list