Cpp Heterogeneous Container

See GenericsVsSubtyping for the origins of this, where there is a discussion of HeterogeneousContainers and HomogeneousContainers, which invited the discussion of HeterogeneousContainers in CeePlusPlus.

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 BoostTupleLibrary, or BoostFusion which also has tuples optionally with the BoostFusionUserExtension. 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 HomogeneousContainer of MutableTypeObjects?, such as those provided by BoostAny, but the effect is more flexible than the first type.


CategoryCpp CategoryContainer CategoryBoost


EditText of this page (last edited December 16, 2014) or FindPage with title or text search