std::ranges...y_split_view(3)

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

πŸ’– std::ranges...y_split_view(3) πŸ’–

okay bestie, welcome to the std::ranges...y_split_view(3) page from the C++ Standard Libary (yes, that's literally how it's spelled up top, no cap πŸ’€). this is all about std::ranges::lazy_split_view::lazy_split_view β€” the constructor, the icon, the moment. let's get into it ✨


🌸 NAME 🌸

std::ranges::lazy_split_view::lazy_split_view β€” literally the constructor for std::ranges::lazy_split_view. that's the whole name section, periodt πŸ’…


✨ Synopsis ✨

here's the exact synopsis, bestie β€” don't let the formatting jump-scare you, it's giving "copy-pasted from a PDF" energy but every token is sacred:

          lazy_split_view()

            requires std::default_initializable<V> &&
       (1) (since C++20)

                     std::default_initializable<Pattern> = default;
          constexpr explicit lazy_split_view( V base, Pattern pattern );
       (2) (since C++20)
          template< ranges::input_range R >

            requires std::constructible_from<V, views::all_t<R>> &&
                     std::constructible_from<Pattern, ranges::single_view<
                                                                             (3)
       (since C++20)
          ranges::range_value_t<R>>>

          constexpr explicit lazy_split_view( R&& r,
          ranges::range_value_t<R> e );

Constructs a lazy_split_view. so what do these three overloads actually do? buckle up:

  1. (1) (since C++20) β€” the default constructor. it value-initializes the underlying view and the delimiter. no args, just vibes ✨
  2. (2) (since C++20) β€” initializes the underlying view with std::move(base) and the delimiter with std::move(pattern). move semantics, we love to see it πŸ’…
  3. (3) (since C++20) β€” initializes the underlying view with views::all(std::forward<R>(r)) and the delimiter with ranges::single_view{std::move(e)}. fancy forwarding, iconic 🫢

πŸŽ€ Parameters πŸŽ€

  • base β€” the underlying view (to be split). it's the main character being chopped up πŸ‘‘
  • pattern β€” view to be used as the delimiter. the thing doing the chopping βœ‚οΈ
  • e β€” element to be used as the delimiter. a single element doing the chopping, lowkey powerful πŸ’…

πŸ¦‹ Example πŸ¦‹

This section is incomplete Reason: no example

literally that's it. not me showing up with no example 😭 but the page says what it says.


πŸ’œ Defect reports πŸ’œ

The following behavior-changing defect reports were applied retroactively to previously published C++ standards. (yes, retroactively, the committee said "we fixed it after the fact, you're welcome" πŸ’€)

  • DR: LWG 3714 (P2711R1)
  • Applied to: C++20
  • Behavior as published: the multi-parameter constructor was not made explicit
  • Correct behavior: explicit

🌈 Category 🌈

  • Todo no example

shoutout to http://cppreference.com, version 2024.06.10, page std::ranges...y_split_view(3) β€” mwah πŸ’‹ go construct something cute, bestie πŸ§šπŸ’–

πŸ“¦ where this page comes from