class template
<functional>
std::less
template <class T> struct less;
Function object class for less-than inequality comparison
Generically, function objects are instances of a class with member function
operator() defined. This member function allows the object to be used with the same syntax as a function call.It is defined with the same behavior as:
|
|
|
|
Objects of this class can be used on standard algorithms such as sort, merge or lower_bound.
Template parameters
- T
- Type of the arguments to compare by the functional call.
The type shall support the operation (operator<).
Member types
| member type | definition | notes |
|---|---|---|
| first_argument_type | T | Type of the first argument in member operator() |
| second_argument_type | T | Type of the second argument in member operator() |
| result_type | bool | Type returned by member operator() |
Member functions
- bool operator() (const T& x, const T& y)
- Member function returning whether the first argument compares less than the second (
x<y).
Example
|
|
Output:
See also
- equal_to
- Function object class for equality comparison (class template)
- not_equal_to
- Function object class for non-equality comparison (class template)
- greater
- Function object class for greater-than inequality comparison (class template)
- greater_equal
- Function object class for greater-than-or-equal-to comparison (class template)
- less_equal
- Function object class for less-than-or-equal-to comparison (class template)