Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

set of sets in C++

Tags:

c++11

set

How to create a set of sets in C++?

set<char> inner1;
set<char> inner2;
set< set<char> > outer;
set< set<char> >:: iterator new_it;
set<char>::iterator it;

for (int i = 65; i < 70; ++i)
    inner1.insert(i);

for (int i = 70; i < 80; ++i)
    inner2.insert(i);

outer.insert(inner1);
outer.insert(inner2);

for(new_it=outer.begin();new_it!=outer.end();new_it++)
{
   for(it=*(new_it);it!=(new_it);)
   {

   }
}
like image 917
Vedang Joshi Avatar asked Dec 27 '14 12:12

Vedang Joshi


1 Answers

You can't assign new_it to it in the inner loop. Do it this way:

for(it = new_it->begin(); it!=new_it->end(); ++it)
like image 148
Beta Avatar answered Sep 22 '22 15:09

Beta