<p>I want to have a map that has a homogeneous key type but heterogeneous data types.</p>

<p>I want to be able to do something like (pseudo-code):</p>

<pre><code>boost::map&lt;std::string, magic_goes_here&gt; m;
m.add&lt;int&gt;("a", 2);
m.add&lt;std::string&gt;("b", "black sheep");

int i = m.get&lt;int&gt;("a");
int j = m.get&lt;int&gt;("b"); // error!
</code></pre>

<p>I could have a pointer to a base class as the data type but would rather not.</p>

<p>I've never used boost before but have looked at the fusion library but can't figure out what I need to do.</p>

<p>Thanks for your help.</p>

How can I build a <favorite container> of objects of different types?
You can't, but you can fake it pretty well. In C/C++ all arrays are homogeneous (i.e., the elements are all the same type). However, with an extra layer of indirection you can give the appearance of a heterogeneous container (a heterogeneous container is a container where the contained objects are of different types).
There are two cases with heterogeneous containers.
The first case occurs when all objects you want to store in a container are publicly derived from a common base class. [...]
The second case occurs when the object types are disjoint — they do not share a common base class.
The approach here is to use a handle class. The container is a container of handle objects (by value or by pointer, your choice; by value is easier). Each handle object knows how to "hold on to" (i.e., maintain a pointer to) one of the objects you want to put in the container. You can use either a single handle class with several different types of pointers as instance data, or a hierarchy of handle classes that shadow the various types you wish to contain (requires the container be of handle base class pointers). The downside of this approach is that it opens up the handle class(es) to maintenance every time you change the set of types that can be contained. The benefit is that you can use the handle class(es) to encapsulate most of the ugliness of memory management and object lifetime. Thus using handle objects may be beneficial even in the first case.