[libcxx-commits] [PATCH] D102006: [libcxx][ranges] Add range.subrange.

Mark de Wever via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Sun May 9 05:10:08 PDT 2021

Mordante added inline comments.

Comment at: libcxx/include/type_traits:2311-2314
+template<class _From>
+[[nodiscard]] constexpr auto __to_unsigned_like(_From __x) noexcept {
+  return static_cast<make_unsigned_t<_From>>(__x);
cjdb wrote:
> Mordante wrote:
> > cjdb wrote:
> > > I wanna poach this for D101922. WDYT?
> > I would like `_LIBCPP_INLINE_VISIBILITY` and I dislike the `_like` suffix. Of course if we remove the `_like` it duplicates `__to_unsigned` defined in `<charconv>`. I start to feel it makes sense to make a header to do some of these signed to unsigned conversions. (I also use them for `<format>` but there I already require `<charconv>`. WDYT? (Note `<charconv>` is available in C++11 as an extension.)
> > I wouldn't mind to put up a review to make this change.
> This is already in main. I'm not sure why it's showing up in the diff.
I see thanks. Any objection to renaming it to `__to_unsigned`? Since `<charconv>` already depends on `<type_traits>` I'll make a patch to let `<charconv>` reuse this function.

  rG LLVM Github Monorepo



More information about the libcxx-commits mailing list