[libcxx-commits] [PATCH] D101638: [libc++] std::to_address mustn't depend on P::element_type.

Arthur O'Dwyer via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Fri Apr 30 08:15:24 PDT 2021


Quuxplusone added inline comments.


================
Comment at: libcxx/include/__memory/pointer_traits.h:200-210
 template <> struct __to_address_helper<false> {
     template <class _Pointer>
-    using __return_type = typename pointer_traits<_Pointer>::element_type*;
+    using __return_type = typename decay<
+        decltype(_VSTD::__to_address(declval<const _Pointer&>().operator->()))
+    >::type;
 
     template <class _Pointer>
----------------
I really want to pull this specialization up to right below the primary template, so that all the definitions of `__to_address_helper` are grouped together. However, that doesn't work, for some reason (probably somehow related to two-phase lookup).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101638



More information about the libcxx-commits mailing list