[libcxx-commits] [PATCH] D127594: [libc++][NFC] Use concepts in <bit>.

Joe Loser via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Sun Jun 12 11:11:08 PDT 2022


jloser added inline comments.


================
Comment at: libcxx/include/__bit/bit_cast.h:27
+           is_trivially_copyable_v<_FromType>)
+_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr _ToType bit_cast(_FromType const& __from) noexcept {
+  return __builtin_bit_cast(_ToType, __from);
----------------
Nit: can we use west const for consistency in a lot of the other places in `libcxx`? E.g. `s/_FromType const&/const _FromType&`.


================
Comment at: libcxx/include/bit:94
 {
     static_assert(__libcpp_is_unsigned_integer<_Tp>::value, "__rotl requires an unsigned integer type");
     const unsigned int __dig = numeric_limits<_Tp>::digits;
----------------
Since we're concept constraining the public functions like `std::rotl` and friends, should we just remove these `static_assert`s in the private functions? I don't see these as ever being called from outside this file from the public function.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D127594



More information about the libcxx-commits mailing list