Mega Code Archive

 
Categories / C++ Tutorial / Map Multimap
 

Use operator of equal (=)

#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 (myOtherPair == myThirdPair) {     cout << "myOtherPair is equal to myThirdPair\n";   } else {     cout << "myOtherPair is not equal to myThirdPair\n";   }   pair<int, int> aPair = make_pair(5, 10);   return (0); }