Daily bit(e) of C++ | std::equal_to, std::not_equal_to, std::greater, std::less, std::greater_equal, std::less_equal and std::compare_three_way
Daily bit(e) of C++ #227, The comparator function objects: std::equal_to, std::not_equal_to, std::greater, std::less, std::greater_equal, std::less_equal and std::compare_three_way.
The function objects std::equal_to, std::not_equal_to, std::greater, std::less, std::greater_equal, std::less_equal and (C++20) std::compare_three_way implement the corresponding comparison operations.
These objects can serve as comparators for algorithms that accept them. This saves us the hassle of writing a lambda just to return the result of comparing the two arguments.