[libcxx-commits] [PATCH] D105894: Revert "[libc++] NFCI: Remove code duplication and obsolete declarations in wrap_iter"

Louis Dionne via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Tue Jul 13 12:45:10 PDT 2021


ldionne commandeered this revision.
ldionne edited reviewers, added: bgraur; removed: ldionne.
ldionne added a comment.

Thanks a lot for the bug report.

I don't think the Standard requires this to work:

  #include <utility> // for std::rel_ops.
  #include <vector>
  
  using namespace std::rel_ops;
  
  struct T;
  void fn() {
    std::vector<T>::const_iterator a;
    for (std::vector<T>::const_iterator i; i >= a;)
      ;
  }

We're allowed to implement `vector::iterator` however we want as long as it's a `LegacyRandomAccessIterator`, which includes being able to compare it as `x < y`, etc. But there is no mention of those comparison operators being required to be injected only when they are used (i.e. implemented as hidden friends).

I'll still try to fix this and add a test (specific to libc++) since this used to work, but I would suggest you try to move away from using `std::rel_ops`, since it's pretty broken anyway.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D105894



More information about the libcxx-commits mailing list