Skip to content

[libc++] Set feature test macros __cpp_lib_ranges_contains and__cpp_lib_ranges_starts_ends_with #81816

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion libcxx/docs/FeatureTestMacroTable.rst
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,8 @@ Status
--------------------------------------------------- -----------------
``__cpp_lib_ranges_chunk_by`` ``202202L``
--------------------------------------------------- -----------------
``__cpp_lib_ranges_contains`` ``202207L``
--------------------------------------------------- -----------------
``__cpp_lib_ranges_iota`` *unimplemented*
--------------------------------------------------- -----------------
``__cpp_lib_ranges_join_with`` *unimplemented*
Expand All @@ -362,7 +364,7 @@ Status
--------------------------------------------------- -----------------
``__cpp_lib_ranges_slide`` *unimplemented*
--------------------------------------------------- -----------------
``__cpp_lib_ranges_starts_ends_with`` *unimplemented*
``__cpp_lib_ranges_starts_ends_with`` ``202106L``
--------------------------------------------------- -----------------
``__cpp_lib_ranges_to_container`` ``202202L``
--------------------------------------------------- -----------------
Expand Down
3 changes: 2 additions & 1 deletion libcxx/docs/ReleaseNotes/19.rst
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ Implemented Papers
- P2637R3 - Member ``visit``
- P2652R2 - Disallow User Specialization of ``allocator_traits``
- P2819R2 - Add ``tuple`` protocol to ``complex``

- P2302R4 - ``std::ranges::contains``
- P1659R3 - ``std::ranges::starts_with`` and ``std::ranges::ends_with``

Improvements and New Features
-----------------------------
Expand Down
4 changes: 2 additions & 2 deletions libcxx/docs/Status/Cxx23Papers.csv
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"`P1328R1 <https://wg21.link/P1328R1>`__","LWG","Making std::type_info::operator== constexpr","June 2021","|Complete|","17.0"
"`P1425R4 <https://wg21.link/P1425R4>`__","LWG","Iterators pair constructors for stack and queue","June 2021","|Complete|","14.0","|ranges|"
"`P1518R2 <https://wg21.link/P1518R2>`__","LWG","Stop overconstraining allocators in container deduction guides","June 2021","|Complete|","13.0"
"`P1659R3 <https://wg21.link/P1659R3>`__","LWG","starts_with and ends_with","June 2021","","","|ranges|"
"`P1659R3 <https://wg21.link/P1659R3>`__","LWG","starts_with and ends_with","June 2021","|Complete|","19.0","|ranges|"
"`P1951R1 <https://wg21.link/P1951R1>`__","LWG","Default Arguments for pair Forwarding Constructor","June 2021","|Complete|","14.0"
"`P1989R2 <https://wg21.link/P1989R2>`__","LWG","Range constructor for std::string_view","June 2021","|Complete|","14.0","|ranges|"
"`P2136R3 <https://wg21.link/P2136R3>`__","LWG","invoke_r","June 2021","|Complete|","17.0"
Expand Down Expand Up @@ -64,7 +64,7 @@
"`P2278R4 <https://wg21.link/P2278R4>`__","LWG","``cbegin`` should always return a constant iterator","July 2022","","","|ranges|"
"`P2286R8 <https://wg21.link/P2286R8>`__","LWG","Formatting Ranges","July 2022","|Complete|","16.0","|format| |ranges|"
"`P2291R3 <https://wg21.link/P2291R3>`__","LWG","Add Constexpr Modifiers to Functions ``to_chars`` and ``from_chars`` for Integral Types in ``<charconv>`` Header","July 2022","|Complete|","16.0"
"`P2302R4 <https://wg21.link/P2302R4>`__","LWG","``std::ranges::contains``","July 2022","","","|ranges|"
"`P2302R4 <https://wg21.link/P2302R4>`__","LWG","``std::ranges::contains``","July 2022","|Complete|","19.0","|ranges|"
"`P2322R6 <https://wg21.link/P2322R6>`__","LWG","``ranges::fold``","July 2022","","","|ranges|"
"`P2374R4 <https://wg21.link/P2374R4>`__","LWG","``views::cartesian_product``","July 2022","","","|ranges|"
"`P2404R3 <https://wg21.link/P2404R3>`__","LWG","Move-only types for ``equality_comparable_with``, ``totally_ordered_with``, and ``three_way_comparable_with``","July 2022","",""
Expand Down
4 changes: 3 additions & 1 deletion libcxx/include/version
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ __cpp_lib_ranges_as_const 202207L <ranges>
__cpp_lib_ranges_as_rvalue 202207L <ranges>
__cpp_lib_ranges_chunk 202202L <ranges>
__cpp_lib_ranges_chunk_by 202202L <ranges>
__cpp_lib_ranges_contains 202207L <algorithm>
__cpp_lib_ranges_iota 202202L <numeric>
__cpp_lib_ranges_join_with 202202L <ranges>
__cpp_lib_ranges_repeat 202207L <ranges>
Expand Down Expand Up @@ -463,11 +464,12 @@ __cpp_lib_within_lifetime 202306L <type_traits>
# define __cpp_lib_ranges_as_rvalue 202207L
// # define __cpp_lib_ranges_chunk 202202L
# define __cpp_lib_ranges_chunk_by 202202L
# define __cpp_lib_ranges_contains 202207L
// # define __cpp_lib_ranges_iota 202202L
// # define __cpp_lib_ranges_join_with 202202L
# define __cpp_lib_ranges_repeat 202207L
// # define __cpp_lib_ranges_slide 202202L
// # define __cpp_lib_ranges_starts_ends_with 202106L
# define __cpp_lib_ranges_starts_ends_with 202106L
# define __cpp_lib_ranges_to_container 202202L
// # define __cpp_lib_ranges_zip 202110L
// # define __cpp_lib_reference_from_temporary 202202L
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
__cpp_lib_freestanding_algorithm 202311L [C++26]
__cpp_lib_parallel_algorithm 201603L [C++17]
__cpp_lib_ranges 202207L [C++20]
__cpp_lib_ranges_contains 202207L [C++23]
__cpp_lib_ranges_starts_ends_with 202106L [C++23]
__cpp_lib_robust_nonmodifying_seq_ops 201304L [C++14]
__cpp_lib_sample 201603L [C++17]
Expand Down Expand Up @@ -52,6 +53,10 @@
# error "__cpp_lib_ranges should not be defined before c++20"
# endif

# ifdef __cpp_lib_ranges_contains
# error "__cpp_lib_ranges_contains should not be defined before c++23"
# endif

# ifdef __cpp_lib_ranges_starts_ends_with
# error "__cpp_lib_ranges_starts_ends_with should not be defined before c++23"
# endif
Expand Down Expand Up @@ -90,6 +95,10 @@
# error "__cpp_lib_ranges should not be defined before c++20"
# endif

# ifdef __cpp_lib_ranges_contains
# error "__cpp_lib_ranges_contains should not be defined before c++23"
# endif

# ifdef __cpp_lib_ranges_starts_ends_with
# error "__cpp_lib_ranges_starts_ends_with should not be defined before c++23"
# endif
Expand Down Expand Up @@ -143,6 +152,10 @@
# error "__cpp_lib_ranges should not be defined before c++20"
# endif

# ifdef __cpp_lib_ranges_contains
# error "__cpp_lib_ranges_contains should not be defined before c++23"
# endif

# ifdef __cpp_lib_ranges_starts_ends_with
# error "__cpp_lib_ranges_starts_ends_with should not be defined before c++23"
# endif
Expand Down Expand Up @@ -205,6 +218,10 @@
# error "__cpp_lib_ranges should have the value 202207L in c++20"
# endif

# ifdef __cpp_lib_ranges_contains
# error "__cpp_lib_ranges_contains should not be defined before c++23"
# endif

# ifdef __cpp_lib_ranges_starts_ends_with
# error "__cpp_lib_ranges_starts_ends_with should not be defined before c++23"
# endif
Expand Down Expand Up @@ -270,17 +287,18 @@
# error "__cpp_lib_ranges should have the value 202207L in c++23"
# endif

# if !defined(_LIBCPP_VERSION)
# ifndef __cpp_lib_ranges_starts_ends_with
# error "__cpp_lib_ranges_starts_ends_with should be defined in c++23"
# endif
# if __cpp_lib_ranges_starts_ends_with != 202106L
# error "__cpp_lib_ranges_starts_ends_with should have the value 202106L in c++23"
# endif
# else // _LIBCPP_VERSION
# ifdef __cpp_lib_ranges_starts_ends_with
# error "__cpp_lib_ranges_starts_ends_with should not be defined because it is unimplemented in libc++!"
# endif
# ifndef __cpp_lib_ranges_contains
# error "__cpp_lib_ranges_contains should be defined in c++23"
# endif
# if __cpp_lib_ranges_contains != 202207L
# error "__cpp_lib_ranges_contains should have the value 202207L in c++23"
# endif

# ifndef __cpp_lib_ranges_starts_ends_with
# error "__cpp_lib_ranges_starts_ends_with should be defined in c++23"
# endif
# if __cpp_lib_ranges_starts_ends_with != 202106L
# error "__cpp_lib_ranges_starts_ends_with should have the value 202106L in c++23"
# endif

# ifndef __cpp_lib_robust_nonmodifying_seq_ops
Expand Down Expand Up @@ -353,17 +371,18 @@
# error "__cpp_lib_ranges should have the value 202207L in c++26"
# endif

# if !defined(_LIBCPP_VERSION)
# ifndef __cpp_lib_ranges_starts_ends_with
# error "__cpp_lib_ranges_starts_ends_with should be defined in c++26"
# endif
# if __cpp_lib_ranges_starts_ends_with != 202106L
# error "__cpp_lib_ranges_starts_ends_with should have the value 202106L in c++26"
# endif
# else // _LIBCPP_VERSION
# ifdef __cpp_lib_ranges_starts_ends_with
# error "__cpp_lib_ranges_starts_ends_with should not be defined because it is unimplemented in libc++!"
# endif
# ifndef __cpp_lib_ranges_contains
# error "__cpp_lib_ranges_contains should be defined in c++26"
# endif
# if __cpp_lib_ranges_contains != 202207L
# error "__cpp_lib_ranges_contains should have the value 202207L in c++26"
# endif

# ifndef __cpp_lib_ranges_starts_ends_with
# error "__cpp_lib_ranges_starts_ends_with should be defined in c++26"
# endif
# if __cpp_lib_ranges_starts_ends_with != 202106L
# error "__cpp_lib_ranges_starts_ends_with should have the value 202106L in c++26"
# endif

# ifndef __cpp_lib_robust_nonmodifying_seq_ops
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@
__cpp_lib_ranges_as_rvalue 202207L [C++23]
__cpp_lib_ranges_chunk 202202L [C++23]
__cpp_lib_ranges_chunk_by 202202L [C++23]
__cpp_lib_ranges_contains 202207L [C++23]
__cpp_lib_ranges_iota 202202L [C++23]
__cpp_lib_ranges_join_with 202202L [C++23]
__cpp_lib_ranges_repeat 202207L [C++23]
Expand Down Expand Up @@ -772,6 +773,10 @@
# error "__cpp_lib_ranges_chunk_by should not be defined before c++23"
# endif

# ifdef __cpp_lib_ranges_contains
# error "__cpp_lib_ranges_contains should not be defined before c++23"
# endif

# ifdef __cpp_lib_ranges_iota
# error "__cpp_lib_ranges_iota should not be defined before c++23"
# endif
Expand Down Expand Up @@ -1604,6 +1609,10 @@
# error "__cpp_lib_ranges_chunk_by should not be defined before c++23"
# endif

# ifdef __cpp_lib_ranges_contains
# error "__cpp_lib_ranges_contains should not be defined before c++23"
# endif

# ifdef __cpp_lib_ranges_iota
# error "__cpp_lib_ranges_iota should not be defined before c++23"
# endif
Expand Down Expand Up @@ -2607,6 +2616,10 @@
# error "__cpp_lib_ranges_chunk_by should not be defined before c++23"
# endif

# ifdef __cpp_lib_ranges_contains
# error "__cpp_lib_ranges_contains should not be defined before c++23"
# endif

# ifdef __cpp_lib_ranges_iota
# error "__cpp_lib_ranges_iota should not be defined before c++23"
# endif
Expand Down Expand Up @@ -3889,6 +3902,10 @@
# error "__cpp_lib_ranges_chunk_by should not be defined before c++23"
# endif

# ifdef __cpp_lib_ranges_contains
# error "__cpp_lib_ranges_contains should not be defined before c++23"
# endif

# ifdef __cpp_lib_ranges_iota
# error "__cpp_lib_ranges_iota should not be defined before c++23"
# endif
Expand Down Expand Up @@ -5357,6 +5374,13 @@
# error "__cpp_lib_ranges_chunk_by should have the value 202202L in c++23"
# endif

# ifndef __cpp_lib_ranges_contains
# error "__cpp_lib_ranges_contains should be defined in c++23"
# endif
# if __cpp_lib_ranges_contains != 202207L
# error "__cpp_lib_ranges_contains should have the value 202207L in c++23"
# endif

# if !defined(_LIBCPP_VERSION)
# ifndef __cpp_lib_ranges_iota
# error "__cpp_lib_ranges_iota should be defined in c++23"
Expand Down Expand Up @@ -5403,17 +5427,11 @@
# endif
# endif

# if !defined(_LIBCPP_VERSION)
# ifndef __cpp_lib_ranges_starts_ends_with
# error "__cpp_lib_ranges_starts_ends_with should be defined in c++23"
# endif
# if __cpp_lib_ranges_starts_ends_with != 202106L
# error "__cpp_lib_ranges_starts_ends_with should have the value 202106L in c++23"
# endif
# else // _LIBCPP_VERSION
# ifdef __cpp_lib_ranges_starts_ends_with
# error "__cpp_lib_ranges_starts_ends_with should not be defined because it is unimplemented in libc++!"
# endif
# ifndef __cpp_lib_ranges_starts_ends_with
# error "__cpp_lib_ranges_starts_ends_with should be defined in c++23"
# endif
# if __cpp_lib_ranges_starts_ends_with != 202106L
# error "__cpp_lib_ranges_starts_ends_with should have the value 202106L in c++23"
# endif

# ifndef __cpp_lib_ranges_to_container
Expand Down Expand Up @@ -7074,6 +7092,13 @@
# error "__cpp_lib_ranges_chunk_by should have the value 202202L in c++26"
# endif

# ifndef __cpp_lib_ranges_contains
# error "__cpp_lib_ranges_contains should be defined in c++26"
# endif
# if __cpp_lib_ranges_contains != 202207L
# error "__cpp_lib_ranges_contains should have the value 202207L in c++26"
# endif

# if !defined(_LIBCPP_VERSION)
# ifndef __cpp_lib_ranges_iota
# error "__cpp_lib_ranges_iota should be defined in c++26"
Expand Down Expand Up @@ -7120,17 +7145,11 @@
# endif
# endif

# if !defined(_LIBCPP_VERSION)
# ifndef __cpp_lib_ranges_starts_ends_with
# error "__cpp_lib_ranges_starts_ends_with should be defined in c++26"
# endif
# if __cpp_lib_ranges_starts_ends_with != 202106L
# error "__cpp_lib_ranges_starts_ends_with should have the value 202106L in c++26"
# endif
# else // _LIBCPP_VERSION
# ifdef __cpp_lib_ranges_starts_ends_with
# error "__cpp_lib_ranges_starts_ends_with should not be defined because it is unimplemented in libc++!"
# endif
# ifndef __cpp_lib_ranges_starts_ends_with
# error "__cpp_lib_ranges_starts_ends_with should be defined in c++26"
# endif
# if __cpp_lib_ranges_starts_ends_with != 202106L
# error "__cpp_lib_ranges_starts_ends_with should have the value 202106L in c++26"
# endif

# ifndef __cpp_lib_ranges_to_container
Expand Down
6 changes: 5 additions & 1 deletion libcxx/utils/generate_feature_test_macro_components.py
Original file line number Diff line number Diff line change
Expand Up @@ -914,6 +914,11 @@ def add_version_header(tc):
"values": {"c++23": 202202},
"headers": ["ranges"],
},
{
"name": "__cpp_lib_ranges_contains",
"values": {"c++23": 202207},
"headers": ["algorithm"],
},
{
"name": "__cpp_lib_ranges_iota",
"values": {"c++23": 202202},
Expand Down Expand Up @@ -941,7 +946,6 @@ def add_version_header(tc):
"name": "__cpp_lib_ranges_starts_ends_with",
"values": {"c++23": 202106},
"headers": ["algorithm"],
"unimplemented": True,
},
{
"name": "__cpp_lib_ranges_to_container",
Expand Down