std::flat_set::end,(3)
πΈ NAME β std::flat_set::end from the C++ Standard Libary manual πΈ
okay so bestie, welcome to std::flat_set::end, π The NAME line is literally std::flat_set::end, β std::flat_set::end, (trailing comma included, we respect the chaos). This is the C++ Standard Library page for it, and yes the original header spells the manual C++ Standard Libary β iconic typo, no cap.
π Synopsis π
Three overloads, 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)
It returns an iterator to the element following the last element of the flat_set. That element is a placeholder, bestie β attempting to access it results in undefined behavior, so do not touch it π.
Thereβs also a diagram placeholder in the original here: range-begin-end.svg πΌοΈ.
π Parameters π
(none) β literally zero parameters. The void is serving. β¨
π Return value π
Iterator to the element following the last element. Thatβs it, thatβs the tea β.
β‘ Complexity β‘
Constant. Not linear, not spicy, just constant. periodt. π
π§ 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.
So no sneaky editing through end() or cend() β the vibes are read-only, fr fr. π«Ά
π Example π
// Run this code β literally go run it:
#include <algorithm>
#include <flat_set>
#include <iostream>
int main()
{
std::flat_set<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 2 3 4 5 6 9
π See also π
beginβ returns an iterator to the beginningcbeginβ (public member function)endcendβ returns an iterator to the end of a container or array(C++11)β (function template)(C++14)
xoxo, your Unix bestie π
β source: http://cppreference.com, version/date: 2024.06.10, page: std::flat_set::end,(3) π«Ά
π¦ where this page comes from
- nixpkgs unstable: stdman 2024.07.05
- opensuse-leap 16.0: stdman 2024.07.05-bp160.1.9 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms