[all-commits] [llvm/llvm-project] 85d4e2: [libc++] Fix __wrap_iter to be a proper contiguous...

Quuxplusone via All-commits all-commits at lists.llvm.org
Wed Sep 22 15:52:19 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 85d4e29fd84e1afe03a589e240e33aa5a5c4b7ce
      https://github.com/llvm/llvm-project/commit/85d4e29fd84e1afe03a589e240e33aa5a5c4b7ce
  Author: Arthur O'Dwyer <arthur.j.odwyer at gmail.com>
  Date:   2021-09-22 (Wed, 22 Sep 2021)

  Changed paths:
    M libcxx/include/__iterator/wrap_iter.h
    M libcxx/test/std/utilities/memory/pointer.conversion/to_address_std_iterators.pass.cpp
    M libcxx/test/std/utilities/memory/pointer.traits/pointer_to.pass.cpp

  Log Message:
  -----------
  [libc++] Fix __wrap_iter to be a proper contiguous iterator.

Instead of overloading `__to_address`, let's specialize `pointer_traits`.
Function overloads need to be in scope at the point where they're called,
whereas template specializations do not. (User code can provide pointer_traits
specializations to be used by already-included library code, so obviously
`__wrap_iter` can do the same.)

`pointer_traits<__wrap_iter<It>>` cannot provide `pointer_to`, because
you generally cannot create a `__wrap_iter` without also knowing the
identity of the container into which you're trying to create an iterator.
I believe this is OK; contiguous iterators are required to provide
`to_address` but *not* necessarily `pointer_to`.

Differential Revision: https://reviews.llvm.org/D110198




More information about the All-commits mailing list