example5_comparing_pair_with_object.cpp

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
#include <iostream>
#include <utility>

int main() {
    std::pair<int, std::string> pair1(1, "Apple");
    std::pair<int, std::string> pair2(2, "Banana");

    if (pair1 < pair2) {
        std::cout << "pair1 is less than pair2" << std::endl;
    }

    return 0;
}
Back to std_pair