Next : , Previous : Arithmetic operations, Top : Table of Contents


Comparisons

equal_to Binary Predicate
not_equal_to Binary Predicate
greater Binary Predicate
less Binary Predicate
greater_equal Binary Predicate
less_equal Binary Predicate

The library provides basic function object classes for all of the comparison operators in the language.

template 
struct equal_to : binary_function {
    bool operator()(const T& x, const T& y) const { return x == y; }
};

template 
struct not_equal_to : binary_function {
    bool operator()(const T& x, const T& y) const { return x != y; }
};

template 
struct greater : binary_function {
    bool operator()(const T& x, const T& y) const { return x > y; }
};

template 
struct less : binary_function {
    bool operator()(const T& x, const T& y) const { return x < y; }
};

template 
struct greater_equal : binary_function {
    bool operator()(const T& x, const T& y) const { return x >= y; }
};

template 
struct less_equal : binary_function {
    bool operator()(const T& x, const T& y) const { return x <= y; }
};

 

Top