Gianni Mariani schrieb:
> jason.cipriani@gmail.com wrote:
> ...
>>
>> Again maybe this is a silly question but I've been confusing the heck
>> out of myself staring at this code all day.
>
> Apart from Frank's suggestion, you could use an Any object.
>
> This is the austria "Any" class.
> http://austria.svn.sourceforge.net/v....h?view=markup
...or you could use a variant class (typesafe union), like
boost::variant, which might be a good idea if you have a limited set of
types.
In case of boost::variant, you then could use the visitor pattern to
operate on the object, instead of a chain of if statements.
I think that a 'typesafe union' is more useful than a 'typesafe void*',
because it is easier to work with a fixed set of types. Your code can
only have a limited number of if/else if statements anyway.
--
Thomas