In C++, a special template allows you to pair one type with any other type as a single object.
#include <utility>
std::pair<std::string, int> myPair;
There are 3 ways to define a pair:
myPair.first = "Hello, this is the string element.";
myPair.second = 42;
std::pair<std::string, int> anotherPair = std::make_pair("sevens", 777);
Since C++11, you can use a generic initializer list in brackets {...} to initialize a pair. You cannot use auto to define it because C++ uses this kind of generic syntax to initialize many STL types besides pairs.
std::pair<std::string, int> anotherPair = {"sevens", 777};
here you have 4 options. all are the same:
std::pair<int,int> point1 = std::pair<int,int>(1,2);
std::pair<int,int> point2 = std::make_pair(1,2);
auto point3 = std::pair<int,int>(1,2);
std::pair<int,int> point4 = {1,2};