[libcxx-commits] [PATCH] D102332: [libc++][nfc] remove duplicated __to_unsigned.

Christopher Di Bella via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Wed May 12 09:40:05 PDT 2021


cjdb added a subscriber: ldionne.
cjdb added inline comments.


================
Comment at: libcxx/include/type_traits:2314-2318
+template <class _Tp>
+_LIBCPP_NODISCARD_ATTRIBUTE _LIBCPP_INLINE_VISIBILITY constexpr
+typename make_unsigned<_Tp>::type __to_unsigned(_Tp __x) noexcept {
+    return static_cast<typename make_unsigned<_Tp>::type>(__x);
 }
----------------
Quuxplusone wrote:
> Re naming: I approve of `__to_unsigned`. It simply converts to the `make_unsigned` version of the type, no more and no less.
> @cjdb, if libc++ ever adds support for user-defined "unsigned-like but not unsigned" types, we can revisit the naming bikeshed (since we'll have to re-audit all the call-sites anyway, it'll actually be //good// to force the pull-requester to touch them all).
If this were the case, then @ldionne wouldn't have asked for the concept `__integer_like`. At the very least, I think we should wait for Louis to chime in on this discussion.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D102332



More information about the libcxx-commits mailing list