std::ranges...in_with_view(3)

πŸ“¦ version 2024.07.05, in nixpkgs unstable, opensuse-leap 16.0

πŸ’… 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:

  1. 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.
  2. Initializes the underlying view with std::move(base) and the stored pattern with std::move(pattern). Moves! We love a move. constexpr explicit, since C++23.
  3. Initializes the underlying view with views::all(std::forward<R>(r)) and the stored pattern with views::single(std::move(e)). Also constexpr explicit, also since C++23. This is the one with the big long requires clause with std::constructible_from twice and ranges::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