std::flat_multiset::begin,(3)

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

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

okay bestie, welcome to this C++ Standard Libary manual page for std::flat_multiset::begin, β€” yes, the manual name has that exact spelling, and yes, the NAME has that little comma. we are keeping every single crumb. πŸ“

πŸ’– NAME πŸ’–

  • std::flat_multiset::begin, - std::flat_multiset::begin,

✨ Synopsis ✨

iterator begin() noexcept;              (1) (since C++23)
const_iterator begin() const noexcept;  (2) (since C++23)
const_iterator cbegin() const noexcept; (3) (since C++23)

so what does it do? it Returns an iterator to the first element of the flat_multiset. slay.

if the flat_multiset is empty, the returned iterator will be equal to end(). important vibe check ✨

there's also a diagram file called range-begin-end.svg doing its little range-begin-end thing in the background.

🌸 Parameters 🌸

(none) β€” no args, no stress, no drama.

πŸŽ€ Return value πŸŽ€

Iterator to the first element. periodt.

πŸ¦‹ Complexity πŸ¦‹

Constant. absolutely no extra effort, iconic behavior.

πŸ‘‘ Notes πŸ‘‘

ngl, this is the important bit, bestie: 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. so don't try to be sneaky with it 😭

🌈 Example 🌈

the page says // Run this code before the snippet:

#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 πŸ’œ

the SEE ALSO section is giving chaotic group-chat energy, but every line is here:

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

mwah πŸ’‹ this page came from http://cppreference.com, dated 2024.06.10, and it's the std::flat_multiset::begin,(3) page. byeee, go iterate responsibly 🫢

πŸ“¦ where this page comes from