Peter Olcott wrote:
> "Simon G Best" <> wrote in message
> news:2-...
>> Peter Olcott wrote:
>>> Is there anyway of doing this besides making my own string from scratch?
>>>
>>> union AnyType {
>>> std::string String;
>>> double Number;
>>> };
>> What do you want a union for? Generally, unions shouldn't be used.
>
> I am creating my own computer language and I need a simple way to store the
> various elemental data types.
boost::any (or somthing similar) should do what you want. They do all
the copy/destruct work that unions don't and you need for std::string.
I wrote a similar beast at::Any. You can get it from:
http://netcabletv.org/public_releases/
(warning - it's big, it contains a number of precompiled libs)