title: How can I store objects of differing types in a C++ container?
body: <p>Is there a C++ container that I could use or build that can contain, say, <code>int</code> and <code>string</code> and <code>double</code> types? The problem I'm facing is that whenever I try to populate, say, a map, vector or list with, say, the following:</p>
  <pre><code>int x;
  string y;
  double z;
  </code></pre>
  <p>I'm restricted with the format:</p>
  <pre><code>list&lt;int&gt; mycountainer;
  vector&lt;string&gt; mycontainer;
  </code></pre>
  <p>which forces <code>mycontainer</code> to only consist of one type.</p>
  <p>Before anyone suggest generics, that wouldn't work either since the standard <code>vector</code> and <code>list</code> containers that come with C++ <strong>are already generic</strong> - they can be container for any types but cannot contain multiple types.</p>
  <p>I would like to avoid using Boost also if at all possible - I'd prefer it if there is a simple way I could code this myself.</p>