std::flat_multiset::end,(3)

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

πŸ’… std::flat_multiset::end,(3) πŸ’…

okay bestie, welcome to the C++ Standard Libary page for std::flat_multiset::end β€” yes, that’s the manual name folded in right here at the top so we can get into the cute stuff. πŸ’–


✨ NAME ✨

std::flat_multiset::end, - std::flat_multiset::end, πŸ’…


🌸 Synopsis 🌸

three flavors, all noexcept, all since C++23:

iterator end() noexcept;              (1) (since C++23)
const_iterator end() const noexcept;  (2) (since C++23)
const_iterator cend() const noexcept; (3) (since C++23)

so basically end() gives you an iterator to the element following the last element of the flat_multiset. that element is a placeholder β€” not me being dramatic β€” and attempting to access it results in undefined behavior. 😭

there’s also a little diagram file in the original: range-begin-end.svg πŸ¦‹


πŸŽ€ Parameters πŸŽ€

(none) β€” literally zero parameters, she takes nothing. ✨


πŸ’– Return value πŸ’–

Iterator to the element following the last element. 🫢


⭐ Complexity ⭐

Constant. πŸ’…


🧚 Notes 🧚

Because both iterator and const_iterator are constant iterators (and may in fact be the same type), it is not possible to mutate the elements of the container through an iterator returned by any of these member functions. no cap. πŸ”₯


🌈 Example 🌈

// Run this code

#include <algorithm>
#include <flat_set>
#include <iostream>

int main()
{
    std::flat_multiset<int> set{3, 1, 4, 1, 5, 9, 2, 6, 5};
    std::for_each(set.cbegin(), set.cend(), [](int x)
    {
        std::cout << x << ' ';
    });
    std::cout << '\n';
}

πŸ“ Output πŸ“

1 1 2 3 4 5 5 6 9

πŸ‘‘ See also πŸ‘‘

  • begin β€” returns an iterator to the beginning
  • cbegin β€” (public member function)
  • end
  • cend β€” returns an iterator to the end of a container or array
  • (C++11) β€” (function template)
  • (C++14)

okay that’s the whole page, bestie 🫢 β€” source/version vibes from http://cppreference.com, dated 2024.06.10, title std::flat_multiset::end,(3), manual C++ Standard Libary. mwah πŸ’‹

πŸ“¦ where this page comes from