title: How to Create All Permutations of Variables from a Variable Number of STL Vectors
body: <p>I have a <strong>variable</strong> number of <code>std::vectors&lt;int&gt;</code>, let's say I have 3 vectors in this example:</p>
  
  <pre><code>std::vector&lt;int&gt; vect1 {1,2,3,4,5};
  std::vector&lt;int&gt; vect2 {1,2,3,4,5};
  std::vector&lt;int&gt; vect3 {1,2,3,4,5};
  </code></pre>
  
  <p>The values of the vectors are not important here. Also, the lengths of these vectors will be variable.</p>
  
  <p>From these vectors, I want to create every permutation of vector values, so:</p>
  
  <pre><code>{1, 1, 1}
  {1, 1, 2}
  {1, 1, 3}
  ...
  ...
  ...
  {3, 5, 5}
  {4, 5, 5}
  {5, 5, 5}
  </code></pre>
  
  <p>I will then insert each combination into a key-value pair map for further use with my application.</p>
  
  <p>What is an efficient way to accomplish this? I would normally just use a <code>for</code> loop, and iterate across all parameters to create all combinations, but the number of vectors is variable. </p>
  
  <p>Thank you.</p>
  
  <p>Edit: I will include more specifics.</p>
  
  <p>So, first off, I'm not really dealing with <code>int</code>s, but rather a custom object. <code>int</code>s are just for simplicity. The vectors themselves exist in a map like so <code>std::map&lt;std::string, std::vector&lt;int&gt; &gt;</code>.</p>
  
  <p>My ultimate goal is to have an <code>std::vector&lt; std::map&lt; std::string, int &gt; &gt;</code>, which is essentially a collection of every possible combination of name-value pairs.</p>