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
;
|
(depuis C++17) | |
|
constexpr
const_iterator cbegin
(
)
const
noexcept
;
|
(depuis C++17) | |
Retourne un itérateur vers le premier caractère de la vue.
Table des matières |
Paramètres
(aucun)
Valeur de retour
const_iterator
vers le premier caractère.
Complexité
Constante.
Exemple
Exécuter ce 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)>); }
Voir aussi
|
renvoie un itérateur vers la fin
(fonction membre publique) |
|
|
(C++11)
|
renvoie un itérateur vers le début
(fonction membre publique de
std::basic_string<CharT,Traits,Allocator>
)
|