Mega Code Archive

 
Categories / C++ Tutorial / Map Multimap
 

Use operator of less than ()

#include <utility> #include <string> #include <iostream> using namespace std; int main(int argc, char** argv){   pair<string, int> myPair("hello", 5), myOtherPair;   myOtherPair.first = "hello";   myOtherPair.second = 6;   pair<string, int> myThirdPair(myOtherPair);   if (myPair < myOtherPair) {     cout << "myPair is less than myOtherPair\n";   } else {     cout << "myPair is greater than or equal to myOtherPair\n";   }   return (0); }