A range adaptor that represents
view
consisting of the sequence obtained from flattening a view of ranges, with every element of the delimiter inserted in between elements of the view. The delimiter can be a single element or a view of elements.
join_with_view
models input_range
.
join_with_view
models forward_range
when:
V
and ranges::range_reference_t<V> each model forward_range
.join_with_view
models bidirectional_range
when:
V
, ranges::range_reference_t<V>, and Pattern
each models bidirectional_range
, andPattern
each model common_range
.join_with_view
models common_range
when:
V
and ranges::range_reference_t<V> each model forward_range
and common_range
.join_with_view
sized_range
or forward_range
std::ranges::view_interface<D>
) [edit] returns a constant iterator to the beginning of the range
std::ranges::view_interface<D>
) [edit] returns a sentinel for the constant iterator of the range
std::ranges::view_interface<D>
) [edit] returns whether the derived view is not empty, provided only if ranges::empty is applicable to it
std::ranges::view_interface<D>
) [edit] returns the first element in the derived view, provided if it satisfies forward_range
std::ranges::view_interface<D>
) [edit] returns the last element in the derived view, provided only if it satisfies bidirectional_range
and common_range
std::ranges::view_interface<D>
) [edit] [edit] Deduction guides [edit] Nested classes the iterator type
#include <iostream> #include <ranges> #include <string_view> #include <vector> int main() { using namespace std::literals; std::vector v{"This"sv, "is"sv, "a"sv, "test."sv}; auto joined = v | std::views::join_with(' '); for (auto c : joined) std::cout << c; std::cout << '\n'; }
Output:
[edit] Defect reportsThe following behavior-changing defect reports were applied retroactively to previously published C++ standards.
DR Applied to Behavior as published Correct behavior LWG 4074 C++23join_with_view
was underconstrained updated the constraints [edit] See also
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4