1.map
Map<int, int> rankdict;//definition map rankdict[1] = 5;rankdict[2] = 6;//map Assignment int dictsize = Rankdict.size ();//map size cout << dictsize <<endl;map<int, Int>::iterator iter;for (iter = Rankdict.begin (); Iter!=rankdict.end (); iter++) {cout << iter->first <<endl;} Traverse Map iter = Rankdict.find (2);//Find cout <<iter->first<< ":" <<iter->second;//first as key, Second is valuerankdict.clear ();//Empty if (Rankdict.empty ()) {//Determine if NULL (True) cout << "Empty";} Rankdict.erase (ITER);//Remove the location of the specified key rankdict.erase (1);//delete the specified key//Because each map data corresponds to a node on a red-black tree, this node occupies 16 bytes when it does not save your data, A parent pointer, left and right child pointer, and an enumeration value (labeled Red-black, equivalent to the balance factor in the balanced binary tree), which is very memory-consuming.
2.enum (enumeration)
Enum keyword{first,second,third}void func (keyword key) { switch (key) {case First :; Case SECOND:; } }
3. Arrays
int numbers[2];//numeric size is constant i = f ();vector<int> vecnumber (i);//can vary size array request int number[] = {2,3,4};//Direct initialization can not write length
C + + Fundamentals (i): Data types and structures