std::ranges...in_with_view(3)
π NAME
okay so bestie, welcome to std::ranges::join_with_view::join_with_view β yes that's the constructor of the constructor page, it's giving "my name is my name" energy and honestly? iconic. This is a page from the C++ Standard Libary manual (that's literally how it's spelled on the page, no I will not be fixing it, we respect the source π«Ά), and the page itself goes by std::ranges...in_with_view(3) because terminal headers are dramatic and love an abbreviation moment. Anyway. It's the constructor. Of join_with_view. Let's get into it β¨
πΈ Synopsis
here's the whole signature situation, copied exactly because I would never do you dirty like that:
join_with_view()
requires std::default_initializable<V> &&
(1) (since C++23)
std::default_initializable<Pattern> = default;
constexpr explicit join_with_view( V base, Pattern pattern );
(2) (since C++23)
template< ranges::input_range R >
requires std::constructible_from<V, views::all_t<R>> &&
std::constructible_from<Pattern,
ranges::single_view<ranges::range_value_t<
(3)
(since C++23)
ranges::range_reference_t<V>>>>
constexpr explicit
join_with_view( R&& r, ranges::range_value_t<
ranges::range_reference_t<V>> e );
okay so like β the whole point of this page: it constructs a join_with_view. that's the vibe. three separate ways to do it, and the deets are:
- The default constructor, bb π€ Value-initializes the underlying view and the pattern. No args, no drama, requires
std::default_initializable<V>&&std::default_initializable<Pattern>, and defaults the whole thing (= default). Since C++23, obviously. - Initializes the underlying view with
std::move(base)and the stored pattern withstd::move(pattern). Moves! We love a move.constexpr explicit, since C++23. - Initializes the underlying view with
views::all(std::forward<R>(r))and the stored pattern withviews::single(std::move(e)). Alsoconstexpr explicit, also since C++23. This is the one with the big longrequiresclause withstd::constructible_fromtwice andranges::single_view<ranges::range_value_t<ranges::range_reference_t<V>>>in it β she's extra but she's worth it π
π Parameters
baseβ a view of ranges to be flattened πpatternβ view to be used as the delimiter πeβ element to be used as the delimiter β
π¦ Example
This section is incomplete Reason: no example
π not the empty example section. bestie the docs said "figure it out yourself." we've all been there.
Category:
- Todo no example
(lowkey the same note twice, but I'm not gonna erase it, that's not the assignment π)
and that's the page!! go forth and construct your join-with-views, you absolute main character ππ
signed, sealed, delivered from http://cppreference.com, dated 2024.06.10, on the page formally known as std::ranges...in_with_view(3). mwah πβ¨
π¦ where this page comes from
- nixpkgs unstable: stdman 2024.07.05
- opensuse-leap 16.0: stdman 2024.07.05-bp160.1.9 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms