Skip to content

[libc++] Implement views::join_with #65536

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

Open
wants to merge 57 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
698bdd6
[libc++] Implement `views::join_with`
JMazurkiewicz Feb 2, 2024
b631ccd
Merge remote-tracking branch 'upstream/main' into libcxx/ranges/join_…
JMazurkiewicz Nov 21, 2024
2370857
Add `[[nodiscard]]` to private functions
JMazurkiewicz Nov 21, 2024
b4afb2c
Add third template argument in `__join_with_view_iterator_category`
JMazurkiewicz Nov 21, 2024
7523023
Add missing <includes>
JMazurkiewicz Nov 27, 2024
5714983
Clang 17 is no longer supported
JMazurkiewicz Nov 27, 2024
6778426
Implement LWG-4074
JMazurkiewicz Nov 27, 2024
3a73fac
Usa `[[no_unique_address]]` in `join_with_view::sentinel`
JMazurkiewicz Nov 27, 2024
f6f603d
Cleanup `[[no_unique_address]]` tests
JMazurkiewicz Nov 28, 2024
e55c077
Test when result of `operator*` is type different from `range_referen…
JMazurkiewicz Nov 28, 2024
5a3996a
Various cleanups
JMazurkiewicz Nov 28, 2024
8b3e36c
Merge remote-tracking branch 'upstream/main' into libcxx/ranges/join_…
JMazurkiewicz Dec 16, 2024
ee942ce
Fix formatting
JMazurkiewicz Dec 16, 2024
56d8850
Fix `example.pass.cpp` test
JMazurkiewicz Dec 16, 2024
15efa6f
Fix `19.rst` file
JMazurkiewicz Dec 16, 2024
f267d76
Enable `iterator/no_unique_address.compile.pass.cpp` test for MSVC
JMazurkiewicz Dec 16, 2024
3ad462c
Fix formatting (again)
JMazurkiewicz Dec 16, 2024
fb5ab01
Remove empty `test_end` function
JMazurkiewicz Jan 9, 2025
4ab1ee2
Test explicitness of default constructor of `join_with_view`
JMazurkiewicz Jan 9, 2025
bf1eeac
Test explicitness of `join_with_view::iterator(iterator<!Const>)` con…
JMazurkiewicz Jan 9, 2025
3771be9
Test explicitness of default constructor of `join_with_view::iterator`
JMazurkiewicz Jan 9, 2025
04942c0
Parametrise `test_pre_increment` on `ref-is-glvalue` being `true` or …
JMazurkiewicz Jan 9, 2025
42ce9c2
Add extra test for `iter_move` (make sure it calls underlying `iter_m…
JMazurkiewicz Jan 9, 2025
21896e9
Remove GCC workaround from `increment.pass.cpp`
JMazurkiewicz Jan 9, 2025
19e4fa2
Add extra test for `iter_swap` (make sure it calls underlying `iter_s…
JMazurkiewicz Jan 9, 2025
14471bc
Make sure `CIter` and `Iter` are different types (`ctor.not_const.pas…
JMazurkiewicz Jan 9, 2025
52ad025
Make sure `CIter` and `Iter` are different types (`eq.pass.cpp`)
JMazurkiewicz Jan 9, 2025
d52bdbf
Make sure `CSent` and `Sent` are different types (`ctor.not_const.pas…
JMazurkiewicz Jan 9, 2025
96eae0b
Make sure `CSent` and `Sent` are different types (`eq.pass.cpp`)
JMazurkiewicz Jan 9, 2025
0dc76bb
Add missing `<array>` include in `iter_swap.pass.cpp`
JMazurkiewicz Jan 13, 2025
9760ec3
Fix `sentinel::operator==`
JMazurkiewicz Jan 13, 2025
8ebaa0c
Merge remote-tracking branch 'upstream/main' into libcxx/ranges/join_…
JMazurkiewicz Jan 16, 2025
d9d0033
Fix formatting
JMazurkiewicz Jan 16, 2025
d3c014f
Clarify some comments in `test_post_increment`
JMazurkiewicz Jan 17, 2025
abe8ab9
Use `_LIBCPP_NODEBUG` attribute
JMazurkiewicz Jan 28, 2025
4972ccc
Merge remote-tracking branch 'upstream/main' into libcxx/ranges/join_…
JMazurkiewicz Jan 28, 2025
4601812
[NFC] Use `// REQUIRES: std-at-least-c++23`
JMazurkiewicz Jan 28, 2025
9847c22
More `_LIBCPP_NODEBUG`
JMazurkiewicz Jan 28, 2025
6a4a0a4
Fix unstable ABI tests
JMazurkiewicz Jan 30, 2025
dfe5543
Merge remote-tracking branch 'upstream/main' into libcxx/ranges/join_…
JMazurkiewicz Jan 30, 2025
60264b0
Target LLVM 21
JMazurkiewicz Jan 30, 2025
36861f1
Trigger CI due to GitHub "incident"
JMazurkiewicz Jan 30, 2025
966b3bb
Merge remote-tracking branch 'upstream/main' into libcxx/ranges/join_…
JMazurkiewicz Feb 8, 2025
3d54775
Add links to GitHub in `21.rst`
JMazurkiewicz Mar 18, 2025
10fdb29
Merge remote-tracking branch 'upstream/main' into libcxx/ranges/join_…
JMazurkiewicz Mar 18, 2025
30d02a1
Merge remote-tracking branch 'upstream/main' into libcxx/ranges/join_…
JMazurkiewicz Mar 31, 2025
6950e48
Don't use `std::is_trivial` (deprecated in C++26)
JMazurkiewicz Apr 14, 2025
41b935b
Merge remote-tracking branch 'upstream/main' into libcxx/ranges/join_…
JMazurkiewicz Apr 14, 2025
a0420dc
Merge remote-tracking branch 'upstream/main' into libcxx/ranges/join_…
JMazurkiewicz May 8, 2025
95ea7bc
`is_reference_v<range_reference_t<_Base>>` => `is_reference_v<_InnerB…
JMazurkiewicz May 15, 2025
8ab29fb
`[[__nodiscard__]]` => `[[nodiscard]]`
JMazurkiewicz May 15, 2025
7198928
Add static member function in `__sentinel` to access priavate member …
JMazurkiewicz May 15, 2025
6cb18ac
Fix `iter_swap.pass.cpp` (friendship issues)
JMazurkiewicz May 15, 2025
37525db
Add `static_cast<bool>` in `end.pass.cpp` to avoid truncation warning…
JMazurkiewicz May 15, 2025
de46d63
Update synopsis in `<ranges>` (LWG-4074)
JMazurkiewicz May 20, 2025
9d6f09b
Merge remote-tracking branch 'upstream/main' into libcxx/ranges/join_…
JMazurkiewicz May 20, 2025
e2351fe
Merge remote-tracking branch 'upstream/main' into libcxx/ranges/join_…
JMazurkiewicz May 21, 2025
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
2 changes: 1 addition & 1 deletion libcxx/docs/FeatureTestMacroTable.rst
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ Status
---------------------------------------------------------- -----------------
``__cpp_lib_ranges_iota`` ``202202L``
---------------------------------------------------------- -----------------
``__cpp_lib_ranges_join_with`` *unimplemented*
``__cpp_lib_ranges_join_with`` ``202202L``
---------------------------------------------------------- -----------------
``__cpp_lib_ranges_repeat`` ``202207L``
---------------------------------------------------------- -----------------
Expand Down
3 changes: 3 additions & 0 deletions libcxx/docs/ReleaseNotes/21.rst
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ Implemented Papers
- P1222R4: A Standard ``flat_set`` (`Github <https://github.com/llvm/llvm-project/issues/105193>`__)
- P2897R7: ``aligned_accessor``: An mdspan accessor expressing pointer over-alignment (`Github <https://github.com/llvm/llvm-project/issues/118372>`__)
- P3247R2: Deprecate the notion of trivial types (`Github <https://github.com/llvm/llvm-project/issues/118387>`__)
- P2441R2: ``views::join_with`` (`Github <https://github.com/llvm/llvm-project/issues/105185>`__)
- P2711R1: Making multi-param constructors of ``views`` ``explicit`` (`Github <https://github.com/llvm/llvm-project/issues/105252>`__)
- P2770R0: Stashing stashing ``iterators`` for proper flattening (`Github <https://github.com/llvm/llvm-project/issues/105250>`__)

Improvements and New Features
-----------------------------
Expand Down
6 changes: 3 additions & 3 deletions libcxx/docs/Status/Cxx23Papers.csv
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"`P2273R3 <https://wg21.link/P2273R3>`__","Making ``std::unique_ptr`` constexpr","2022-02 (Virtual)","|Complete|","16",""
"`P2387R3 <https://wg21.link/P2387R3>`__","Pipe support for user-defined range adaptors","2022-02 (Virtual)","|Complete|","19",""
"`P2440R1 <https://wg21.link/P2440R1>`__","``ranges::iota``, ``ranges::shift_left`` and ``ranges::shift_right``","2022-02 (Virtual)","|Partial|","","Only ``ranges::iota`` is implemented."
"`P2441R2 <https://wg21.link/P2441R2>`__","``views::join_with``","2022-02 (Virtual)","|In Progress|","",""
"`P2441R2 <https://wg21.link/P2441R2>`__","``views::join_with``","2022-02 (Virtual)","|Complete|","21",""
"`P2442R1 <https://wg21.link/P2442R1>`__","Windowing range adaptors: ``views::chunk`` and ``views::slide``","2022-02 (Virtual)","","",""
"`P2443R1 <https://wg21.link/P2443R1>`__","``views::chunk_by``","2022-02 (Virtual)","|Complete|","18",""
"","","","","",""
Expand Down Expand Up @@ -103,9 +103,9 @@
"`P2708R1 <https://wg21.link/P2708R1>`__","No Further Fundamentals TSes","2022-11 (Kona)","|Nothing To Do|","",""
"","","","","",""
"`P0290R4 <https://wg21.link/P0290R4>`__","``apply()`` for ``synchronized_value<T>``","2023-02 (Issaquah)","","",""
"`P2770R0 <https://wg21.link/P2770R0>`__","Stashing stashing ``iterators`` for proper flattening","2023-02 (Issaquah)","|Partial|","","``join_with_view`` hasn't been done yet since this type isn't implemented yet"
"`P2770R0 <https://wg21.link/P2770R0>`__","Stashing stashing ``iterators`` for proper flattening","2023-02 (Issaquah)","|Complete|","21",""
"`P2164R9 <https://wg21.link/P2164R9>`__","``views::enumerate``","2023-02 (Issaquah)","","",""
"`P2711R1 <https://wg21.link/P2711R1>`__","Making multi-param constructors of ``views`` ``explicit``","2023-02 (Issaquah)","|In Progress|","","``join_with_view`` hasn't been done yet since this type isn't implemented yet"
"`P2711R1 <https://wg21.link/P2711R1>`__","Making multi-param constructors of ``views`` ``explicit``","2023-02 (Issaquah)","|Complete|","21",""
"`P2609R3 <https://wg21.link/P2609R3>`__","Relaxing Ranges Just A Smidge","2023-02 (Issaquah)","|Complete|","20","Implemented as a DR in C++20. Other implementations will do the same."
"`P2713R1 <https://wg21.link/P2713R1>`__","Escaping improvements in ``std::format``","2023-02 (Issaquah)","|Complete|","19",""
"`P2675R1 <https://wg21.link/P2675R1>`__","``format``'s width estimation is too approximate and not forward compatible","2023-02 (Issaquah)","|Complete|","17",""
Expand Down
2 changes: 1 addition & 1 deletion libcxx/docs/Status/Cxx2cIssues.csv
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
"`LWG4060 <https://wg21.link/LWG4060>`__","``submdspan`` preconditions do not forbid creating invalid pointer","2024-06 (St. Louis)","","",""
"`LWG4061 <https://wg21.link/LWG4061>`__","Should ``std::basic_format_context`` be default-constructible/copyable/movable?","2024-06 (St. Louis)","|Complete|","19",""
"`LWG4071 <https://wg21.link/LWG4071>`__","``reference_wrapper`` comparisons are not SFINAE-friendly","2024-06 (St. Louis)","|Complete|","19",""
"`LWG4074 <https://wg21.link/LWG4074>`__","``compatible-joinable-ranges`` is underconstrained","2024-06 (St. Louis)","","",""
"`LWG4074 <https://wg21.link/LWG4074>`__","``compatible-joinable-ranges`` is underconstrained","2024-06 (St. Louis)","|Complete|","21",""
"`LWG4076 <https://wg21.link/LWG4076>`__","``concat_view`` should be freestanding","2024-06 (St. Louis)","","",""
"`LWG4079 <https://wg21.link/LWG4079>`__","Missing Preconditions in ``concat_view::iterator``\`s conversion constructor","2024-06 (St. Louis)","","",""
"`LWG4082 <https://wg21.link/LWG4082>`__","``views::concat(r)`` is well-formed when ``r`` is an ``output_range``","2024-06 (St. Louis)","","",""
Expand Down
1 change: 1 addition & 0 deletions libcxx/include/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -705,6 +705,7 @@ set(files
__ranges/iota_view.h
__ranges/istream_view.h
__ranges/join_view.h
__ranges/join_with_view.h
__ranges/lazy_split_view.h
__ranges/movable_box.h
__ranges/non_propagating_cache.h
Expand Down
40 changes: 40 additions & 0 deletions libcxx/include/__ranges/concepts.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
#ifndef _LIBCPP___RANGES_CONCEPTS_H
#define _LIBCPP___RANGES_CONCEPTS_H

#include <__concepts/common_reference_with.h>
#include <__concepts/constructible.h>
#include <__concepts/convertible_to.h>
#include <__concepts/movable.h>
#include <__concepts/same_as.h>
#include <__config>
Expand All @@ -25,6 +27,8 @@
#include <__ranges/enable_view.h>
#include <__ranges/size.h>
#include <__type_traits/add_pointer.h>
#include <__type_traits/common_reference.h>
#include <__type_traits/common_type.h>
#include <__type_traits/is_reference.h>
#include <__type_traits/remove_cvref.h>
#include <__type_traits/remove_reference.h>
Expand Down Expand Up @@ -133,6 +137,42 @@ concept viewable_range =
(is_lvalue_reference_v<_Tp> ||
(movable<remove_reference_t<_Tp>> && !__is_std_initializer_list<remove_cvref_t<_Tp>>))));

# if _LIBCPP_STD_VER >= 23

template <class... _Rs>
using __concat_reference_t _LIBCPP_NODEBUG = common_reference_t<range_reference_t<_Rs>...>;

template <class... _Rs>
using __concat_value_t _LIBCPP_NODEBUG = common_type_t<range_value_t<_Rs>...>;

template <class... _Rs>
using __concat_rvalue_reference_t _LIBCPP_NODEBUG = common_reference_t<range_rvalue_reference_t<_Rs>...>;

template <class _Ref, class _RRef, class _It>
concept __concat_indirectly_readable_impl = requires(const _It __it) {
{ *__it } -> convertible_to<_Ref>;
{ ranges::iter_move(__it) } -> convertible_to<_RRef>;
};

template <class... _Rs>
concept __concat_indirectly_readable =
common_reference_with<__concat_reference_t<_Rs...>&&, __concat_value_t<_Rs...>&> &&
common_reference_with<__concat_reference_t<_Rs...>&&, __concat_rvalue_reference_t<_Rs...>&&> &&
common_reference_with<__concat_rvalue_reference_t<_Rs...>&&, const __concat_value_t<_Rs...>&> &&
(__concat_indirectly_readable_impl<__concat_reference_t<_Rs...>,
__concat_rvalue_reference_t<_Rs...>,
iterator_t<_Rs>> &&
...);

template <class... _Rs>
concept __concatable = requires {
typename __concat_reference_t<_Rs...>;
typename __concat_value_t<_Rs...>;
typename __concat_rvalue_reference_t<_Rs...>;
} && __concat_indirectly_readable<_Rs...>;

# endif // _LIBCPP_STD_VER >= 23

} // namespace ranges

#endif // _LIBCPP_STD_VER >= 20
Expand Down
Loading
Loading