generate subsets recursively
<p>I'm trying to generate all possible subsets for a specific bool vector of size 3. So there should be 8 possible subsets:</p>

<pre><code>#include&lt;iostream&gt;
#include&lt;fstream&gt;
#include&lt;string&gt;
#include&lt;stdio.h&gt;
#include&lt;stdlib.h&gt;
#include&lt;vector&gt;

using namespace std;
int n = 3;
int mis(vector&lt;bool&gt; f,int i){
        for(int j=0; j &lt;f.size();j++)
            cout&lt;&lt;f[i]&lt;&lt;" ";
        cout&lt;&lt;endl; 
        f[i] = false;
        return mis(f,i+1);
        f[i] = true;
        return mis(f,i+1);
}

int main(){
    vector&lt;bool&gt; f;
    f.resize(n);
    int m = mis(f,0);
}
</code></pre>

<p>I'm getting the following error:</p>

<pre><code>a.out: malloc.c:3096: sYSMALLOc: Assertion `(old_top == (((mbinptr) (((char *) &amp;((av)-&gt;bins[((1) - 1) * 2])) - __builtin_offsetof (struct malloc_chunk, fd)))) &amp;&amp; old_size == 0) || ((unsigned long) (old_size) &gt;= (unsigned long)((((__builtin_offsetof (struct malloc_chunk, fd_nextsize))+((2 * (sizeof(size_t))) - 1)) &amp; ~((2 * (sizeof(size_t))) - 1))) &amp;&amp; ((old_top)-&gt;size &amp; 0x1) &amp;&amp; ((unsigned long)old_end &amp; pagemask) == 0)' failed.
Aborted
</code></pre>
