|
Output:
Size of first: 0 Size of second: 3 |
/* using namespace std;
map <int, int>::iterator m1_pIter, m2_pIter;
map <int, int> m1, m2;
typedef pair <int, int> Int_Pair;
m1.insert ( Int_Pair ( 1, 10 ) );
m1.insert ( Int_Pair ( 2, 20 ) );
m1.insert ( Int_Pair ( 3, 30 ) );
m1.insert ( Int_Pair ( 4, 40 ) );
m2 = m1;
map <int, int>::iterator m1_pIter, m2_pIter;
map <int, int> m1, m2;
typedef pair <int, int> Int_Pair;
m1.insert ( Int_Pair ( 1, 10 ) );
m1.insert ( Int_Pair ( 2, 20 ) );
m1.insert ( Int_Pair ( 3, 30 ) );
m1.insert ( Int_Pair ( 4, 40 ) );
m2 = m1;
*/
可以直接利用=号操作符 进行赋值操作