Skip to content

Commit f41894c

Browse files
committed
[libc++] Implement P2242R1 std::views::chunk
This PR implements libc++ `std::ranges::chunk_view` in header <__ranges/chunk_view.h>. We also provide several unit tests in `libcxx/test/std/ranges/range.adaptors/range.chunk/`.
1 parent 73a1383 commit f41894c

File tree

18 files changed

+964
-6
lines changed

18 files changed

+964
-6
lines changed

libcxx/docs/FeatureTestMacroTable.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ Status
370370
---------------------------------------------------------- -----------------
371371
``__cpp_lib_ranges_as_rvalue`` ``202207L``
372372
---------------------------------------------------------- -----------------
373-
``__cpp_lib_ranges_chunk`` *unimplemented*
373+
``__cpp_lib_ranges_chunk`` ``202202L``
374374
---------------------------------------------------------- -----------------
375375
``__cpp_lib_ranges_chunk_by`` ``202202L``
376376
---------------------------------------------------------- -----------------

libcxx/docs/ReleaseNotes/22.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ Implemented Papers
4949
- P2835R7: Expose ``std::atomic_ref``'s object address (`Github <https://llvm.org/PR118377>`__)
5050
- P2944R3: Comparisons for ``reference_wrapper`` (`Github <https://llvm.org/PR105424>`__)
5151
- P3168R2: Give ``std::optional`` Range Support (`Github <https://llvm.org/PR105430>`__)
52+
- P2442R1: Add ``std::views::chunk`` (`Github <https://llvm.org/PR171109>`__)
5253

5354
Improvements and New Features
5455
-----------------------------

libcxx/docs/Status/Cxx23Papers.csv

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@
4848
"`P2387R3 <https://wg21.link/P2387R3>`__","Pipe support for user-defined range adaptors","2022-02 (Virtual)","|Complete|","19","`#105183 <https://github.com/llvm/llvm-project/issues/105183>`__",""
4949
"`P2440R1 <https://wg21.link/P2440R1>`__","``ranges::iota``, ``ranges::shift_left`` and ``ranges::shift_right``","2022-02 (Virtual)","|Partial|","","`#105184 <https://github.com/llvm/llvm-project/issues/105184>`__","Only ``ranges::iota`` is implemented."
5050
"`P2441R2 <https://wg21.link/P2441R2>`__","``views::join_with``","2022-02 (Virtual)","|Complete|","21","`#105185 <https://github.com/llvm/llvm-project/issues/105185>`__",""
51-
"`P2442R1 <https://wg21.link/P2442R1>`__","Windowing range adaptors: ``views::chunk`` and ``views::slide``","2022-02 (Virtual)","","","`#105187 <https://github.com/llvm/llvm-project/issues/105187>`__",""
52-
"`P2443R1 <https://wg21.link/P2443R1>`__","``views::chunk_by``","2022-02 (Virtual)","|Complete|","18","`#105188 <https://github.com/llvm/llvm-project/issues/105188>`__",""
51+
"`P2442R1 <https://wg21.link/P2442R1>`__","Windowing range adaptors: ``views::chunk`` and ``views::slide``","2022-02 (Virtual)","|Partial|","22","`#105187 <https://github.com/llvm/llvm-project/issues/105187>`__",""
52+
"`P2443R1 <https://wg21.link/P2443R1>`__","``views::chunk_by``","2022-02 (Virtual)","|Complete|","18","`#105188 <https://github.com/llvm/llvm-project/issues/105188>`__","Only ``views::chunk`` is implemented."
5353
"","","","","","",""
5454
"`P0009R18 <https://wg21.link/P0009R18>`__","mdspan: A Non-Owning Multidimensional Array Reference","2022-07 (Virtual)","|Complete|","18","`#105189 <https://github.com/llvm/llvm-project/issues/105189>`__",""
5555
"`P0429R9 <https://wg21.link/P0429R9>`__","A Standard ``flat_map``","2022-07 (Virtual)","|Complete|","20","`#105190 <https://github.com/llvm/llvm-project/issues/105190>`__",""

libcxx/include/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -703,6 +703,7 @@ set(files
703703
__ranges/all.h
704704
__ranges/as_rvalue_view.h
705705
__ranges/chunk_by_view.h
706+
__ranges/chunk_view.h
706707
__ranges/common_view.h
707708
__ranges/concepts.h
708709
__ranges/container_compatible_range.h

libcxx/include/__cxx03/module.modulemap

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1701,6 +1701,7 @@ module cxx03_std_private_ranges_all [system] {
17011701
}
17021702
module cxx03_std_private_ranges_as_rvalue_view [system] { header "__ranges/as_rvalue_view.h" }
17031703
module cxx03_std_private_ranges_chunk_by_view [system] { header "__ranges/chunk_by_view.h" }
1704+
module cxx03_std_private_ranges_chunk_view [system] { header "__ranges/chunk_view.h" }
17041705
module cxx03_std_private_ranges_common_view [system] { header "__ranges/common_view.h" }
17051706
module cxx03_std_private_ranges_concepts [system] {
17061707
header "__ranges/concepts.h"

0 commit comments

Comments
 (0)