std::basic_string_view<CharT,Traits>:: begin, std::basic_string_view<CharT,Traits>:: cbegin
From cppreference.net
<
cpp
|
string
|
basic string view
|
constexpr
const_iterator begin
(
)
const
noexcept
;
|
(seit C++17) | |
|
constexpr
const_iterator cbegin
(
)
const
noexcept
;
|
(seit C++17) | |
Gibt einen Iterator auf das erste Zeichen der Ansicht zurück.
Inhaltsverzeichnis |
Parameter
(keine)
Rückgabewert
const_iterator
zum ersten Zeichen.
Komplexität
Konstante.
Beispiel
Diesen Code ausführen
#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)>); }
Siehe auch
|
gibt einen Iterator zum Ende zurück
(öffentliche Elementfunktion) |
|
|
(C++11)
|
gibt einen Iterator zum Anfang zurück
(öffentliche Elementfunktion von
std::basic_string<CharT,Traits,Allocator>
)
|