Johan wrote:
Where can I find coding example in C++ for homogeneous container.
std::deque<int>
There - they integers, so they are all the same: homo!
Nonono I'm not calling you "homo" - that's what "homo" means: same!
Oh, you meant a "heterogenous container". That's: different!
If you need a hetero container of primitives - int, float, string - you need
a VARIANT type. Check out your nearest non-Standard library, such as Qt, or
boost.org, or COM. They provide types such as QVariant, Any, or _variant_t,
which hold many kinds of primitives, and handles to ORB objects.
Put them all in bed together like this:
std::deque<QVariant>
Next, if you need to store many types derived from a base class, you need a
collection of pointers to it:
std::deque<Base *>
Now you can push the addresses of objects of classes derived from Base into
the collection.
That won't delete any heap objects when the deque disappears, so see
www.boost.org for adapters such as shared_ptr<>, and for more code samples
than you thought possible.
[BTW there were several other wicked puns available here, so I deserve
credit for the superhuman effort of avoiding them;]
--
Phlip
http://industrialxp.org/community/bi...UserInterfaces