[libcxx-commits] [PATCH] D116991: [libc++] [ranges] SFINAE away ranges::cbegin(const T&&) for non-borrowed T.

Casey Carter via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Tue Jan 11 09:38:17 PST 2022


CaseyCarter added a comment.

FWIW, the updated tests pass when run against MSVC STL.



================
Comment at: libcxx/include/__ranges/access.h:166
     template <class _Tp>
+      requires is_lvalue_reference_v<_Tp&&>
     [[nodiscard]] _LIBCPP_HIDE_FROM_ABI
----------------
`&&` is extraneous - `_Tp` is an lvalue reference if and only if `_Tp&&` is an lvalue reference. (Also on 194.)


================
Comment at: libcxx/include/__ranges/access.h:171
+      -> decltype(      ranges::begin(static_cast<const __uncvref_t<_Tp>&>(__t)))
+      { return          ranges::begin(static_cast<const __uncvref_t<_Tp>&>(__t)); }
 
----------------
I'd use `remove_reference_t` instead of `__uncvref_t` to preserve `volatile`. (6 places, including lines 197-199)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D116991



More information about the libcxx-commits mailing list