Thanks again Jonathan. I'm happy as long as the type_info object doesn't go out of scope
when the object is deleted.
By the way, can you point me to where this is covered in the C++ spec? I'm not an expert,
but I do like to fill in my knowledge gaps whenever I get the chance. :-)
--Kevin
-----Original Message-----
From: jonathan.wakely@stripped [mailto:jonathan.wakely@stripped] On Behalf Of Jonathan
Wakely
Sent: Monday, June 15, 2009 1:34 AM
To: Kevin Regan
Cc: plusplus@stripped
Subject: Re: Why dynamic allocation for Option objects?
On 14/06/2009, Kevin Regan wrote:
> By singleton, I meant that each type only had a single type_info object that
> is returned for all objects of that type.
That's not strictly true either, calls in shared libraries might get
distinct type_info objects, which is why you should always compare
them for equality (using operator==) not identity (i.e. by comparing
their addresses)
But they do persist until the end of the program, so your change is still OK,
Jonathan