www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Is writing typeinfo to a file ok?

How should one write a typeinfo to a file?
What occurs to me is:

import	std.stream;

class	F	: BufferedFile
void  read  (out TypeInfo t)
{  int  siz;
    Stream.read (siz);
    if	(readBlock(cast(void*)t, siz) != siz)  throw new 
Exception ("Wrong size block read");

void	write (TypeInfo t)
{  Stream.write (t.sizeof);
    if (writeBlock (cast(void*)t, t.sizeof) != t.sizeof)
    {   throw new Exception ("Wrong size block written");  }

void main()
{  F  f;

And it compiles all right.  But would there be a problem if I 
wrote during one invocation of a program, and later read to 
reconstruct the state?
Feb 10 2007