I am looking to find all subsets of some set of size n, e.g. {{}, {1}, {1, 2} etc. } using the method described here.
My issue arises with attempting to build a set of sets with C++11. Namely, I have a set<set<int> > permutations which contains all my subsets. If I attempt to insert some integer element i into each of the subsets contained in permutations, as follows:
for (set<set<int> >::iterator it = permutations.begin(); it != permutations.end(); ++it)
{
it->insert(i); //error here
}
I run into a "no instance of overloaded function matches the argument list (the object has type qualifiers that prevent a match" error. My understanding is that iterator it refers to a set<int> object, and so *it has member function insert(). What is causing this particular error to arise?