title: vector of vector with different types
body: <p>I would like to construct a vector of vectors. This question has already been posted many time on SO but I did not find a satisfying answer. That because:</p>
  
  <ul>
  <li>each vector can have a different type</li>
  <li>I don't know the types at compilation time</li>
  <li>I don't know how many vectors it will contain</li>
  </ul>
  
  <p>Basically I would like to be able to do something like that in pseudo code
  later</p>
  
  <pre><code>types = ["char", "int", "double", "int"]
  container&lt;vector&gt; x
  
  foreach (type in types)
  {
    if (type == "char")
      x.push_back(vector&lt;char&gt;)
    else if (type == "int")
      x.push_back(vector&lt;int&gt;)
    else
      x.push_back(vector&lt;double&gt;)
  }
  </code></pre>
  
  <p>and then I would like to be able to do for example</p>
  
  <pre><code>x[0].push_back("a")
  x[1].push_back(1)
  x[2].push_back(3.1416)
  </code></pre>
  
  <p>I think <code>boost::any</code> may help me but I'm not familiar with boost yet.</p>
  
  <p>The point is, even if it sound weird, it is really what I want to do. I don't want a vector of structures, I really want a container (no matter which one) containing <code>std::vector</code> of different types. The reason is because I'm reading binary files. The header of the file states the number of data and their types but it can change from a file to another. Thus it cannot be known at compilation time.</p>