Cpp Heterogeneous Container
for the origins of this, where there is a discussion of
s, which invited the discussion of
Here are two possible ways of organising this. There may be more.
One is to build a container which can contain different types of object but with designated types of object in each position. This can be implemented using the
which also has tuples optionally with the
. It also has a powerful set of macros which make it very easy to set up a container with access using user defined keys.
The second is to have a container which contains objects of all the same type, but which are capable of holding data of different types. Strictly speaking this is a
, such as those provided by
, but the effect is more flexible than the first type.
View edit of
December 16, 2014
with title or text search