如何在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);)
{
}
}
答案 0 :(得分:5)
您无法在内循环中将new_it
分配给it
。这样做:
for(it = new_it->begin(); it!=new_it->end(); ++it)