A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://en.cppreference.com/w/cpp/language/../utility/program/../../ranges/join_with_view.html below:

std::ranges::views::join_with, std::ranges::join_with_view - cppreference.com

std::ranges::join_with_view 1)

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:

join_with_view models bidirectional_range when:

join_with_view models common_range when:

[edit] Nested types [edit] Data members [edit] Member functions constructs a join_with_view
(public member function) [edit] returns a copy of the underlying (adapted) view
(public member function) [edit] returns an iterator to the beginning
(public member function) [edit] returns an iterator or a sentinel to the end
(public member function) [edit] Inherited from std::ranges::view_interface returns whether the derived view is empty, provided only if it satisfies sized_range or forward_range
(public member function of std::ranges::view_interface<D>) [edit] returns a constant iterator to the beginning of the range
(public member function of std::ranges::view_interface<D>) [edit] returns a sentinel for the constant iterator of the range
(public member function of std::ranges::view_interface<D>) [edit] returns whether the derived view is not empty, provided only if ranges::empty is applicable to it
(public member function of std::ranges::view_interface<D>) [edit] returns the first element in the derived view, provided if it satisfies forward_range
(public member function of std::ranges::view_interface<D>) [edit] returns the last element in the derived view, provided only if it satisfies bidirectional_range and common_range
(public member function of std::ranges::view_interface<D>) [edit] [edit] Deduction guides [edit] Nested classes the iterator type
(exposition-only member class template*) the sentinel type
(exposition-only member class template*) [edit] Notes [edit] Example
#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 reports

The following behavior-changing defect reports were applied retroactively to previously published C++ standards.

DR Applied to Behavior as published Correct behavior LWG 4074 C++23 join_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