CARVIEW |
Select Language
HTTP/1.1 301 Moved Permanently
Server: nginx
Date: Wed, 23 Jul 2025 09:27:11 GMT
Content-Type: text/html; charset=UTF-8
Transfer-Encoding: chunked
Connection: keep-alive
Location: /reference/functional/less/
HTTP/1.1 200 OK
Server: nginx
Date: Wed, 23 Jul 2025 09:27:11 GMT
Content-Type: text/html; charset=utf-8
Transfer-Encoding: chunked
Connection: keep-alive
ETag: W/"8dfd-5FDuWcMjy8FaOKwJXl6H+SC4HGE"
Content-Encoding: gzip
Binary function object class whose call returns whether the its first argument compares less than the second (as returned by operator <).
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.
Output:
Reference
C library:
- <cassert> (assert.h)
- <cctype> (ctype.h)
- <cerrno> (errno.h)
-
<cfenv> (fenv.h)C++11
- <cfloat> (float.h)
-
<cinttypes> (inttypes.h)C++11
- <ciso646> (iso646.h)
- <climits> (limits.h)
- <clocale> (locale.h)
- <cmath> (math.h)
- <csetjmp> (setjmp.h)
- <csignal> (signal.h)
- <cstdarg> (stdarg.h)
-
<cstdbool> (stdbool.h)C++11
- <cstddef> (stddef.h)
-
<cstdint> (stdint.h)C++11
- <cstdio> (stdio.h)
- <cstdlib> (stdlib.h)
- <cstring> (string.h)
-
<ctgmath> (tgmath.h)C++11
- <ctime> (time.h)
-
<cuchar> (uchar.h)C++11
- <cwchar> (wchar.h)
- <cwctype> (wctype.h)
Containers:
-
<array>C++11
- <deque>
-
<forward_list>C++11
- <list>
- <map>
- <queue>
- <set>
- <stack>
-
<unordered_map>C++11
-
<unordered_set>C++11
- <vector>
-
Input/Output:
Multi-threading:
-
<atomic>C++11
-
<condition_variable>C++11
-
<future>C++11
-
<mutex>C++11
-
<thread>C++11
-
Other:
- <algorithm>
- <bitset>
-
<chrono>C++11
-
<codecvt>C++11
- <complex>
- <exception>
- <functional>
-
<initializer_list>C++11
- <iterator>
- <limits>
- <locale>
- <memory>
- <new>
- <numeric>
-
<random>C++11
-
<ratio>C++11
-
<regex>C++11
- <stdexcept>
- <string>
-
<system_error>C++11
-
<tuple>C++11
-
<type_traits>C++11
-
<typeindex>C++11
- <typeinfo>
- <utility>
- <valarray>
<functional>
functions
wrapper classes
- binary_negate
-
functionC++11
-
reference_wrapperC++11
- unary_negate
operator classes
other classes
-
bad_function_callC++11
-
hashC++11
-
is_bind_expressionC++11
-
is_placeholderC++11
-
namespaces
-
placeholdersC++11
-
deprecated
- Reference
- <functional>
- less
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:
foo includes bar. |
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)
Home page | Privacy policy
© cplusplus.com, 2000-2025 - All rights reserved - v3.3.4s
Spotted an error? contact us
© cplusplus.com, 2000-2025 - All rights reserved - v3.3.4s
Spotted an error? contact us