65,187
社区成员




#include "stdafx.h"
#include <stdio.h>
#include <map>
#include <iostream>
using namespace std;
class C
{
public:
int category;
};
typedef map<int,C*> M;
int main(int argc, char* argv[])
{
map<int, C*> myMap1,myMap2;
map< int, M* > myMap;
C c1,c2,c3,c4;
c1.category = 1;
c2.category = 2;
c3.category = 3;
c4.category = 4;
myMap1[1] = &c1;
myMap1[2] = &c2;
myMap2[1] = &c3;
myMap2[2] = &c4;
myMap[1] = &myMap1;
myMap[2] = &myMap2;
map< int, M* >::iterator it, itend;
it = myMap.begin();
itend = myMap.end();
for (; it != itend; it++)
{
map< int, C*>::iterator it1, it2;
it1 =(*(it->second)).begin();
it2 =(*(it->second)).end();
for ( ; it1 != it2; it1++)
{
cout<<(it1->second)->category<<endl;
}
}
return 0;
}