Tutorial by Examples

Pair allows us to treat two objects as one object. Pairs can be easily constructed with the help of template function std::make_pair. Alternative way is to create pair and assign its elements (first and second) later. #include <iostream> #include <utility> int main() { std::p...
Parameters of these operators are lhs and rhs operator== tests if both elements on lhs and rhs pair are equal. The return value is true if both lhs.first == rhs.first AND lhs.second == rhs.second, otherwise false std::pair<int, int> p1 = std::make_pair(1, 2); std::pair<int, int> ...

Page 1 of 1