[all-commits] [llvm/llvm-project] 6b4b8d: [ADT] Relax iterator constraints on all_equal (#10...

aws-taylor via All-commits all-commits at lists.llvm.org
Wed Aug 28 13:02:56 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 6b4b8dc4a45dccec43a9c0d76a80ebae50df55b0
      https://github.com/llvm/llvm-project/commit/6b4b8dc4a45dccec43a9c0d76a80ebae50df55b0
  Author: aws-taylor <57725958+aws-taylor at users.noreply.github.com>
  Date:   2024-08-28 (Wed, 28 Aug 2024)

  Changed paths:
    M llvm/include/llvm/ADT/STLExtras.h
    M llvm/unittests/ADT/STLExtrasTest.cpp

  Log Message:
  -----------
  [ADT] Relax iterator constraints on all_equal (#106400)

The previous `all_equal` implementation contained `Begin + 1`, which
implicitly requires `Begin` to model the
[random_access_iterator](https://en.cppreference.com/w/cpp/iterator/random_access_iterator)
concept due to the usage of the `+` operator. By swapping this out with
`std::next`, this method can be used with weaker iterator concepts, such
as
[forward_iterator](https://en.cppreference.com/w/cpp/iterator/forward_iterator).

---------

Co-authored-by: Jakub Kuderski <kubakuderski at gmail.com>



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list