[all-commits] [llvm/llvm-project] 37f903: [libc++] Make drop_view::begin constant time (#728...

Hongyu Ouyang via All-commits all-commits at lists.llvm.org
Thu Dec 28 13:27:55 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 37f9036320e37527a58586fb0ba99ca473755574
      https://github.com/llvm/llvm-project/commit/37f9036320e37527a58586fb0ba99ca473755574
  Author: Hongyu Ouyang <96765450+casavaca at users.noreply.github.com>
  Date:   2023-12-28 (Thu, 28 Dec 2023)

  Changed paths:
    M libcxx/include/__ranges/drop_view.h
    M libcxx/test/std/ranges/range.adaptors/range.drop/begin.pass.cpp
    M libcxx/test/std/ranges/range.adaptors/range.drop/types.h

  Log Message:
  -----------
  [libc++] Make drop_view::begin constant time (#72883) (#72929)

As pointed out in #72883, the implementation only needs to return the
value of ranges::next and does not need to obtain the value through
ranges::advance, which causes it to have O(n) complexity in the case
of random-access-sized but non-common range.

Fixes #72883




More information about the All-commits mailing list