[libcxx-commits] [PATCH] D128864: [libc++] Fix algorithms which use reverse_iterator

Konstantin Varlamov via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Thu Jul 21 01:23:24 PDT 2022


var-const requested changes to this revision.
var-const added a comment.
This revision now requires changes to proceed.

@philnik My initial impression is that we shouldn't try to solve this at the library level. This looks like a legitimate issue with the core language.

If I understand it correctly (and please point out if I'm wrong), the issue is that there is no perfect match for `operator==`, and the only `operator==` available has essentially this form:

  bool operator==(const BaseIter&, const DerivedIter&);

Which would work except that the C++20 rewriting rules also generate the same function with reversed arguments:

  bool operator==(const DerivedIter&, const BaseIter&);

Which then becomes ambiguous.

I think it would be easier to rewrite our existing algorithms to avoid using `reverse_iterator`. We can add a TODO to revisit the implementation when (and if) the core language issue gets fixed.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D128864



More information about the libcxx-commits mailing list