[libcxx-commits] [PATCH] D110515: [libc++] [compare] Named comparison functions, is_eq etc.

Arthur O'Dwyer via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Mon Sep 27 09:15:40 PDT 2021


Quuxplusone added inline comments.


================
Comment at: libcxx/include/__compare/is_eq.h:23-28
+constexpr bool is_eq(partial_ordering __c) noexcept { return __c == 0; }
+constexpr bool is_neq(partial_ordering __c) noexcept { return __c != 0; }
+constexpr bool is_lt(partial_ordering __c) noexcept { return __c < 0; }
+constexpr bool is_lteq(partial_ordering __c) noexcept { return __c <= 0; }
+constexpr bool is_gt(partial_ordering __c) noexcept { return __c > 0; }
+constexpr bool is_gteq(partial_ordering __c) noexcept { return __c >= 0; }
----------------
(1) Not marked `_LIBCPP_HIDE_FROM_ABI`, because I can't imagine their ABI will ever change, but I don't really understand the meaning of the marking, and maybe it's better to mark them; @ldionne opinion?

(2) TIL (again) that although `constexpr` on a global variable implies `static`, `constexpr` on a function implies `inline`. So it's correct that these header-defined functions aren't explicitly marked `inline`; they still have the right behavior.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D110515/new/

https://reviews.llvm.org/D110515



More information about the libcxx-commits mailing list