std::ranges...rator::base(3)

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

okay so bestie, pull up a seat 🫢 β€” this is std::ranges...rator::base(3) from the C++ Standard Library manual, and we’re about to make iterator internals make sense πŸ’…βœ¨

πŸ’– NAME πŸ’–

std::ranges::elements_view::iterator::base β€” std::ranges::elements_view::iterator::base

🌸 Synopsis 🌸

okay so there are two overloads, both iconic, both since C++20:

(1) (since C++20)

constexpr const ranges::iterator_t<Base>& base() const & noexcept;

(2) (since C++20)

constexpr ranges::iterator_t<Base> base() &&;

Returns the underlying iterator. underlying iterator is the main character here, fr fr 🌈

  • 1) Returns a reference to the underlying iterator.
  • 2) Move constructs the result from the underlying iterator.

✨ Parameters ✨

(none) β€” literally no parameters, she’s low-maintenance πŸ’…

πŸŽ€ Return value πŸŽ€

  • 1) A reference to the underlying iterator.
  • 1) An iterator move constructed from the underlying iterator. (yes bestie, the page labels both of them 1) β€” iconic typo energy, but that’s what it says πŸ™ˆ)

πŸ¦‹ Example πŸ¦‹

This section is incomplete

Reason: no example

no cap, there is literally no example here 😭

πŸ”₯ Defect reports πŸ”₯

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

  • DR: LWG 3533 β€” Applied to: C++20 β€” Behavior as published: the const& overload of base returns a copy of the underlying iterator β€” Correct behavior: returns a reference.
  • DR: LWG 3593 β€” Applied to: C++20 β€” Behavior as published: the const& overload of base might not be noexcept β€” Correct behavior: made noexcept.

πŸ’… Category πŸ’…

Category: * Todo no example


mwah πŸ’‹ that’s the std::ranges...rator::base(3) tea β€” source: http://cppreference.com, version/date: 2024.06.10 πŸŒΈπŸŽ€

πŸ“¦ where this page comes from