Pete Becker schrieb:
> Roland Pibinger wrote:
>> On Wed, 04 Oct 2006 08:50:26 -0400, Pete Becker <>
>> wrote:
>>> wrote:
>>>> Do you know is it possible to put different kinds of tuples to one
>>>> container?
>>>> E.g. to a vector?
>>> void* will do it.
>>
>> A little OO will do it even better!
>
> You misrepresented what I said by snipping the following, which is what
> I replied to:
>
>> -> Is it possible to make a pointer, which can point to all of these
>> tuples?)
>
> Plonk.
Huh? Is this a reason to plonk?
The OP didn't fully specify if he want to _store_ or _point_ to different
types, he wrote:
> // -> Is it possible to store those e.g. to a vector?
and:
> -> Is it possible to make a pointer, which can point to all of these
> tuples?)
So one way is to point to these tuples with a void*, but there is no way to
find the type of the pointed object afterwards.
A better way is to use some more OO concepts, where you can hold the type
together with the pointer, or store the tuples directly into the vector,
depends on the needs of the OP.
So "A little OO will do it even better!" is a valid suggestion in my eyes.
To the OP:
I would recommend boost::variant or boost::any.
With both, you can store the pointers to the tuples, or the tuples directly
in the container.
--
Thomas
http://www.netmeister.org/news/learn2quote.html