Mega Code Archive

 
Categories / C++ Tutorial / Map Multimap
 

Use make_pair() function to create a pair

#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);   pair<int, int> aPair = make_pair(5, 10);   return (0); }