std::set::b...set::cbegin(3)
π NAME π
std::set::begin,std::set::cbegin β and yes bestie, the NAME literally repeats itself as std::set::begin,std::set::cbegin, iconic behavior. This is page std::set::b...set::cbegin(3) from the C++ Standard Libary manual.
β¨ Synopsis β¨
iterator begin(); (1) (noexcept since C++11)
const_iterator begin() const; (2) (noexcept since C++11)
const_iterator cbegin() const noexcept; (3) (since C++11)
Returns an iterator to the first element of the set.
If the set is empty, the returned iterator will be equal to end().
Thereβs also a little visual in the original called range-begin-end.svg β itβs giving diagram energy π¦.
π Parameters π
(none) β zero arguments, she takes nothing, no cap.
πΈ Return value πΈ
Iterator to the first 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.
libc++ backports cbegin() to C++98 mode. cute little backport moment π
π Example π
// Run this code
#include <algorithm>
#include <iostream>
#include <set>
int main()
{
std::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 π
endβ returns an iterator to the endcendβ (public member function)(C++11)begin,cbeginβ returns an iterator to the beginning of a container or array(C++11)(function template)(C++14)
Source/version/date, bestie: http://cppreference.com Β· 2024.06.10 Β· page std::set::b...set::cbegin(3). Mwah πβ¨
π¦ 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