vector pair of use

coupling structure is a sequence pair <x, y>

If we want to use the pair but does not need to map its sort, can be used in the vector pair of

Insert pair using make_pair <typename, typename> (x, y); or make_pair (x, y);

Defined using the pair of vector: vector <pair <int, int >> ivec_p;

To insert an element vector: ivec.push_back (make_pair <int, int> (x, y));

Call the pair of values: vector <pair <int, int >> :: iterator it;

         for(it=iter.begin();it!=iter.end();it++){

        cout<<(*iter).first<<(*iter).second<<endl;}

 

Quote from: https://blog.csdn.net/linxihe123/article/details/70173476

Guess you like

Origin www.cnblogs.com/hfut-freshguy/p/11565984.html