std::experimental::ranges::equal_to

From cppreference.com
< cpp‎ | experimental‎ | ranges
 
 
Technical specifications
Filesystem library (filesystem TS)
Library fundamentals (library fundamentals TS)
Library fundamentals 2 (library fundamentals 2 TS)
Extensions for parallelism (parallelism TS)
Extensions for concurrency (concurrency TS)
Concepts (concepts TS)
Ranges (ranges TS)
Special mathematical functions (special math TR)
 
 
General utilities library
Utility components
Function objects
equal_to
Metaprogramming and type traits
Tagged pairs and tuples
                                        
                                        
                                        
                                        
 
template <class T = void>

    requires /* see below */

struct equal_to;
(ranges TS)

Function object for performing comparisons. Unless specialized, invokes operator == on type T.

Parameters

T - object type
Type requirements
-
T must meet one of the following requirements: EqualityComparable, Same<T, void> or BUILTIN_PTR_CMP (const T&, ==, const T&)(see below).

Member functions

operator()
checks if the arguments are equal
(public member function)

operator() has effects equivalent to: return equal_to<>(x, y);

Notes

In this section, BUILTIN_PTR_CMP (T, op, U) for types T and U and where op is an equality or relational operator is a boolean constant expression. BUILTIN_PTR_CMP (T, op, U) is true if and only if op in the expression declval<T>() op declval<U>() resolves to a built-in operator comparing pointers. There is an implementation-defined strict total ordering over all pointer values of a given type. This total ordering is consistent with the partial order imposed by the builtin operators <, >, <=, and >=.

Specializations

template <> struct equal_to<void> {
    template <class T, class U>
        requires EqualityComparableWith<T, U> || BUILTIN_PTR_CMP (T, ==, U)
    constexpr bool operator()(T&& t, U&& u) const;
 
    typedef /* unspecified */ is_transparent;
};
1) Requires:
  • If the expression std::forward<T>(t) == std::forward<U>(u) results in a call to a builtin operator == comparing pointers of type P, the conversion sequences from both T and U to P shall be equality-preserving.
2) Effects:
  • If the expression std::forward<T>(t) == std::forward<U>(u) results in a call to a built-in operator == comparing pointers of type P: returns false if either (the converted value of) t precedes u or u precedes t in the implementation-defined strict total order over pointers of type P and otherwise true.
  • Otherwise, equivalent to: return std::forward<T>(t) == std::forward<U>(u);

Example

See also

function object implementing x == y
(class template)