[libcxx-commits] [PATCH] D110198: [libc++] Fix __wrap_iter to be a proper contiguous iterator.

Louis Dionne via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Wed Sep 22 10:01:05 PDT 2021


ldionne requested changes to this revision.
ldionne added a comment.
This revision now requires changes to proceed.

This is much nicer, thanks!

Can you please add tests in `test/libcxx` for `pointer_to`? It's not clear to me that it works at all.



================
Comment at: libcxx/include/__iterator/wrap_iter.h:287
+template <class _It>
+struct _LIBCPP_TEMPLATE_VIS pointer_traits<__wrap_iter<_It> >
+{
----------------
I think we should only specialize for `__wrap_iter<_Tp*>`, or perhaps for any `_It` that is a contiguous iterator. Otherwise, we're not guaranteed that it's legal to call `to_address(__w.base())` below. WDYT?


================
Comment at: libcxx/include/__iterator/wrap_iter.h:307
+
+    _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
+    static pointer pointer_to(typename conditional<is_void<element_type>::value,
----------------



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110198



More information about the libcxx-commits mailing list