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

Zoe Carver via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Fri Apr 30 11:17:29 PDT 2021


zoecarver accepted this revision as: zoecarver.
zoecarver added a comment.

This is great, thanks for working on this (and related)! I think this will fix some of the sfinae issues I was having with `contiguous_iterator`.

Do you know if `__wap_iter` plays nice with `to_address` after this patch? I suspect it will because it won't try to use `element_type` to determine the return type (it will just use `operator->`).



================
Comment at: libcxx/include/__memory/pointer_traits.h:178
+struct __to_address_helper {
     template <class _Pointer>
+    using __return_type = typename decay<
----------------
(Non-blocking) Could we get rid of `__return_type` and just make this `auto` everywhere? We'd have to change `__choose_to_address` to something like `_IsValidExpansion<decltype(pointer_traits<_Pointer>::to_address(declval<const _Pointer&>()))>`. I don't know if that would work but wdyt?


================
Comment at: libcxx/test/std/utilities/memory/pointer.conversion/to_address.pass.cpp:58
+struct P5 {
+    using element_type = Irrelevant;
+    int const* const& operator->() const;
----------------
Not sure if this is substantially different, what about a test where `element_type = int*`?


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