title: Create all possible combinations using a deque and recursion C++
body: <p>I have a deque that contains a series of numbers <code>{0, 1, 2, 3, 4, 5, 6}</code> and I am trying to create all possible combinations of these numbers using recursion.</p>
  
  <p>Here is my current code</p>
  
  <pre><code>void combination(vector&lt;node&gt; &amp;comb, deque&lt;node&gt; &amp;numbers) {
  
      if (numbers.empty()) {
          for (unsigned int i = 0; i &lt; comb.size(); i++) {
              cout &lt;&lt; comb[i].id &lt;&lt; " ";
          }
          cout &lt;&lt; "\n";
          return;
      }
  
      comb.push_back(numbers.front());
      numbers.pop_front();
      combination(comb, numbers);
      comb.pop_back();
      combination(comb, numbers);
  }
  </code></pre>
  
  <p>I've ran this through on paper and it makes sense but when I run it this is the output:</p>
  
  <pre><code>0 1 2 3 4 5 6
  0 1 2 3 4 5
  0 1 2 3 4
  0 1 2 3
  0 1 2
  0 1
  0
  </code></pre>
  
  <p>Why isn't the function printing out all possible combinations?</p>
  
  <p>Also, this is what I want to use - A deque that contains the numbers and a vector that contains each combination.</p>