1// make_pair example
2#include <utility> // std::pair
3#include <iostream> // std::cout
4
5int main () {
6 std::pair <int,int> foo;
7 std::pair <int,int> bar;
8
9 foo = std::make_pair (10,20);
10 bar = std::make_pair (10.5,'A'); // ok: implicit conversion from pair<double,char>
11
12 std::cout << "foo: " << foo.first << ", " << foo.second << '\n';
13 std::cout << "bar: " << bar.first << ", " << bar.second << '\n';
14
15 return 0;
16}
1#include <utility> // std::pair
2#include <iostream> // std::cout
3
4int main () {
5 std::pair <int,int> foo;
6 std::pair <int,int> bar;
7
8 foo = std::make_pair (10,20);
9 bar = std::make_pair (10.5,'A'); // ok: implicit conversion from pair<double,char>
10
11 std::cout << "foo: " << foo.first << ", " << foo.second << '\n';
12 std::cout << "bar: " << bar.first << ", " << bar.second << '\n';
13
14 return 0;
15}