All subsets of 250000

Given up to 250000 numbers i have to produce a list of subsets(first of one element, then of two etc).
Is there an easy way using a bitset<250000> ?
Thanks
What exactly do you need? Something like that?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include <algorithm>
#include <iostream>
#include <vector>


void print(const std::vector<int>& values, const std::vector<bool>& perm)
{
    for(unsigned i = 0; i < perm.size(); ++i)
        if(perm[i])
            std::cout << values[i] << ' ';
    std::cout << std::endl;
}

int main()
{
    std::vector<int> values {1, 2, 3, 4, 5, 6, 7, 8, 9, 0};
    for(unsigned i = 0; i <= values.size(); ++i) {
        std::vector<bool> perm(values.size() - i, 0);
        perm.resize(values.size(), 1);
        do {
            print(values, perm);
        } while(std::next_permutation(perm.begin(), perm.end()));
    }
}
http://ideone.com/hNAv14
Topic archived. No new replies allowed.