std::pair

a way to store two heterogeneous objects as a single unit. A pair is a specific case of a std::tuple with two elements. - cppreference.com

see also

#include <utility>
  
std::pair p(2, 4.5);     // deduces to std::pair<int, double> p(2, 4.5); - since C++17

or
int a[2], b[3];
std::pair p{a, b}; // explicit deduction guide is used in this case

auto p = std::make_pair(1, 3.14);
std::cout << '(' << std::get<0>(p) << ", " << std::get<1>(p) << ")\n";
std::cout << '(' << std::get<int>(p) << ", " << std::get<double>(p) << ")\n";
Written on June 7, 2023, Last update on June 7, 2023
c++ tuple