[all-commits] [llvm/llvm-project] 9f6439: [libc++][ranges] Implement P2494R2 (Relaxing range...

yronglin via All-commits all-commits at lists.llvm.org
Sat Jun 24 17:16:09 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 9f6439f1c5a3e98d03b7416449a256062e420003
      https://github.com/llvm/llvm-project/commit/9f6439f1c5a3e98d03b7416449a256062e420003
  Author: yronglin <yronglin777 at gmail.com>
  Date:   2023-06-25 (Sun, 25 Jun 2023)

  Changed paths:
    M libcxx/docs/FeatureTestMacroTable.rst
    M libcxx/docs/Status/Cxx23Papers.csv
    M libcxx/include/CMakeLists.txt
    R libcxx/include/__ranges/copyable_box.h
    M libcxx/include/__ranges/drop_while_view.h
    M libcxx/include/__ranges/filter_view.h
    M libcxx/include/__ranges/iota_view.h
    A libcxx/include/__ranges/movable_box.h
    M libcxx/include/__ranges/single_view.h
    M libcxx/include/__ranges/take_while_view.h
    M libcxx/include/__ranges/transform_view.h
    M libcxx/include/module.modulemap.in
    M libcxx/include/version
    R libcxx/test/libcxx/ranges/range.adaptors/range.copy.wrap/arrow.pass.cpp
    R libcxx/test/libcxx/ranges/range.adaptors/range.copy.wrap/assign.copy.pass.cpp
    R libcxx/test/libcxx/ranges/range.adaptors/range.copy.wrap/assign.move.pass.cpp
    R libcxx/test/libcxx/ranges/range.adaptors/range.copy.wrap/ctor.default.pass.cpp
    R libcxx/test/libcxx/ranges/range.adaptors/range.copy.wrap/ctor.in_place.pass.cpp
    R libcxx/test/libcxx/ranges/range.adaptors/range.copy.wrap/deref.pass.cpp
    R libcxx/test/libcxx/ranges/range.adaptors/range.copy.wrap/has_value.pass.cpp
    R libcxx/test/libcxx/ranges/range.adaptors/range.copy.wrap/no_unique_address.pass.cpp
    R libcxx/test/libcxx/ranges/range.adaptors/range.copy.wrap/properties.compile.pass.cpp
    R libcxx/test/libcxx/ranges/range.adaptors/range.copy.wrap/types.h
    A libcxx/test/libcxx/ranges/range.adaptors/range.move.wrap/arrow.pass.cpp
    A libcxx/test/libcxx/ranges/range.adaptors/range.move.wrap/assign.copy.pass.cpp
    A libcxx/test/libcxx/ranges/range.adaptors/range.move.wrap/assign.move.pass.cpp
    A libcxx/test/libcxx/ranges/range.adaptors/range.move.wrap/ctor.default.pass.cpp
    A libcxx/test/libcxx/ranges/range.adaptors/range.move.wrap/ctor.in_place.pass.cpp
    A libcxx/test/libcxx/ranges/range.adaptors/range.move.wrap/deref.pass.cpp
    A libcxx/test/libcxx/ranges/range.adaptors/range.move.wrap/has_value.pass.cpp
    A libcxx/test/libcxx/ranges/range.adaptors/range.move.wrap/no_unique_address.pass.cpp
    A libcxx/test/libcxx/ranges/range.adaptors/range.move.wrap/properties.compile.pass.cpp
    A libcxx/test/libcxx/ranges/range.adaptors/range.move.wrap/types.h
    M libcxx/test/std/language.support/support.limits/support.limits.general/algorithm.version.compile.pass.cpp
    M libcxx/test/std/language.support/support.limits/support.limits.general/functional.version.compile.pass.cpp
    M libcxx/test/std/language.support/support.limits/support.limits.general/iterator.version.compile.pass.cpp
    M libcxx/test/std/language.support/support.limits/support.limits.general/memory.version.compile.pass.cpp
    M libcxx/test/std/language.support/support.limits/support.limits.general/ranges.version.compile.pass.cpp
    M libcxx/test/std/language.support/support.limits/support.limits.general/version.version.compile.pass.cpp
    M libcxx/test/std/ranges/range.adaptors/range.transform/general.pass.cpp
    M libcxx/test/std/ranges/range.factories/range.single.view/cpo.pass.cpp
    M libcxx/utils/data/ignore_format.txt
    M libcxx/utils/generate_feature_test_macro_components.py
    M llvm/utils/gn/secondary/libcxx/include/BUILD.gn

  Log Message:
  -----------
  [libc++][ranges] Implement P2494R2 (Relaxing range adaptors to allow for move only types)

Implement P2494R2 `Relaxing range adaptors to allow for move only types`

https://open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2494r2.html#wording-ftm

According to the words in P2494R2, I haven't add new test for `drop_while_view`, `take_while_view` and `filter_view`, because these views has the requirement that the predicate is an `indirect_unary_predicate`, which requires that the predicate is `copy_constructible`, so they still can't accept move only types as predicate.

```
[P2483R0] also suggests future work to relax the requirements on the predicate types stored by standard views. This paper does not perform this relaxation, as the copy constructibility requirement is enshrined in the indirect callable concepts ([indirectcallable.indirectinvocable]). Thus, while this paper modifies the views that currently use copyable-box for user provided predicates, it only does so to apply the rename of the exposition-only type to movable-box; it does not change any of the constraints on those views. It does, however, relax the requirements on invocables accepted by the transform family of views, because those are not constrained using the indirect callable concepts.
```

Reviewed By: #libc, var-const

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




More information about the All-commits mailing list