命名空间
变体
操作

std::equal_to<void>

来自 cppreference.cn
< cpp‎ | utility‎ | functional
 
 
 
函数对象
函数调用
(C++17)(C++23)
身份函数对象
(C++20)
透明运算符包装器
(C++14)
(C++14)
(C++14)
(C++14)  
(C++14)
(C++14)
(C++14)
(C++14)
(C++14)
(C++14)
equal_to<>
(C++14)
(C++14)
(C++14)

旧式绑定器和适配器
(直到 C++17*)
(直到 C++17*)
(直到 C++17*)
(直到 C++17*)  
(直到 C++17*)
(直到 C++17*)(直到 C++17*)(直到 C++17*)(直到 C++17*)
(直到 C++20*)
(直到 C++20*)
(直到 C++17*)(直到 C++17*)
(直到 C++17*)(直到 C++17*)

(直到 C++17*)
(直到 C++17*)(直到 C++17*)(直到 C++17*)(直到 C++17*)
(直到 C++20*)
(直到 C++20*)
 
定义于头文件 <functional>
template<>
class equal_to<void>;
(自 C++14 起)

std::equal_to<void>std::equal_to 的特化,带有推导的参数和返回类型。

目录

[编辑] 嵌套类型

嵌套类型 定义
is_transparent 未指定

[编辑] 成员函数

operator()
测试两个参数是否相等
(公共成员函数)

std::equal_to<void>::operator()

template< class T, class U >

constexpr auto operator()( T&& lhs, U&& rhs ) const

    -> decltype(std::forward<T>(lhs) == std::forward<U>(rhs));

返回 lhsrhs 之间相等性比较的结果。

参数

lhs, rhs - 要比较的值

返回值

std::forward<T>(lhs) == std::forward<U>(rhs).

[编辑] 示例

#include <functional>
 
int main()
{
    constexpr int a = 0, b = 8;
    std::equal_to<> equal{};
    static_assert(equal(a, a));
    static_assert(!equal(a, b));
}