【问题标题】:Is there a std::less/std::greater for the spaceship operator?宇宙飞船操作员是否有 std::less/std::greater ?
【发布时间】:2021-01-07 11:16:27
【问题描述】:

所有基本比较(<<===!=>=>)都有一个关联的函数对象(std::lessstd::less_equalstd::equal_tostd::not_equal_to, std::greater_equal, std::greater)。

宇宙飞船算子<=>有类似的函数对象吗? 如果没有,为什么没有加入标准库?

【问题讨论】:

    标签: c++ c++20 comparison-operators spaceship-operator


    【解决方案1】:

    std::compare_three_way 是用于三向比较的函数对象(又名宇宙飞船算子)。

    【讨论】:

    • 嗯,cppreference 上似乎缺少一些链接,以便在不知道其名称的情况下轻松找到它。
    • @rubenvb cppref 是一项协作努力。你可以edit
    • @rubenvb 它does now
    猜你喜欢
    • 2011-01-30
    • 1970-01-01
    • 2023-02-05
    • 2015-08-26
    • 2012-12-14
    • 2021-07-27
    • 1970-01-01
    • 2021-04-23
    • 1970-01-01
    相关资源
    最近更新 更多