[libcxx-commits] [PATCH] D130835: [libc++] Fix a hard error in `contiguous_iterator<NoOperatorArrowIter>`.

Konstantin Varlamov via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Sun Jul 31 02:12:44 PDT 2022


var-const added inline comments.


================
Comment at: libcxx/include/__memory/pointer_traits.h:228
 inline _LIBCPP_INLINE_VISIBILITY constexpr
-auto to_address(const _Pointer& __p) noexcept {
+auto to_address(const _Pointer& __p) noexcept -> decltype(std::__to_address(__p)) {
     return _VSTD::__to_address(__p);
----------------
I'm not sure this is the right fix, but I can't think of too many alternatives (another one is to add a constraint to `contiguous_iterator` for the type to have `operator->` defined).


================
Comment at: libcxx/test/std/iterators/iterator.requirements/iterator.concepts/iterator.concept.random.access/contiguous_iterator.compile.pass.cpp:226
+    reference operator*() const;
+    pointer operator->() const requires (!DisableArrow);
+    auto operator<=>(const self&) const = default;
----------------
What do you think of this approach? I think it could be useful for other types that follow a similar pattern (*almost* support a certain constraint).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D130835



More information about the libcxx-commits mailing list