std::basic_...iew::cbegin(3)
π NAME π
Okay bestie, this is the std::basic_...iew::cbegin(3) page from the C++ Standard Libary β yes, βLibary,β we are keeping that exactly as the manual name says, no autocorrect erasure π
.
The entry is: std::basic_string_view::begin,std::basic_string_view::cbegin β and the description is literally the same string again: std::basic_string_view::begin,std::basic_string_view::cbegin. Iconic repetition, no notes β¨.
β¨ Synopsis β¨
constexpr const_iterator begin() const noexcept; (since C++17)
constexpr const_iterator cbegin() const noexcept; (since C++17)
It returns an iterator to the first character of the view. Thatβs the whole vibe π¦.
Also, the original has a lil diagram reference: range-begin-end.svg π.
π Parameters π
(none) β no parameters, not even a tiny one, bestie. Periodt.
π Return value π
const_iterator to the first character. Slay.
πΈ Complexity πΈ
Constant. Lowkey the easiest complexity to remember π₯.
π Example π
// Run this code
#include <concepts>
#include <string_view>
int main()
{
constexpr std::string_view str_view("abcd");
constexpr auto begin = str_view.begin();
constexpr auto cbegin = str_view.cbegin();
static_assert(
*begin == 'a' and
*cbegin == 'a' and
*begin == *cbegin and
begin == cbegin and
std::same_as<decltype(begin), decltype(cbegin)>);
}
π See also π
endβ returns an iterator to the endcendβ (public member function)beginβ returns an iterator to the beginningcbeginβ (public member function ofstd::basic_string<CharT,Traits,Allocator>) (C++11)
Thatβs the whole page, bestie π«Ά. Source/version/date: http://cppreference.com, 2024.06.10, page std::basic_...iew::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