std::basic_string_view<CharT,Traits>:: end, std::basic_string_view<CharT,Traits>:: cend
From cppreference.net
<
cpp
|
string
|
basic string view
|
constexpr
const_iterator end
(
)
const
noexcept
;
|
(depuis C++17) | |
|
constexpr
const_iterator cend
(
)
const
noexcept
;
|
(depuis C++17) | |
Retourne un itérateur vers le caractère suivant le dernier caractère de la vue. Ce caractère agit comme un espace réservé, toute tentative d'y accéder entraîne un comportement indéfini.
Table des matières |
Paramètres
(aucun)
Valeur de retour
const_iterator
vers le caractère suivant le dernier caractère.
Complexité
Constante.
Exemple
Exécuter ce code
#include <iostream> #include <iterator> #include <string_view> int main() { constexpr std::string_view str_view("abcd"); constexpr auto end = str_view.end(); constexpr auto cend = str_view.cend(); static_assert ( *std::prev(end) == 'd' && 'd' == *std::prev(cend) and end == cend ); }
Voir aussi
|
renvoie un itérateur vers le début
(fonction membre publique) |
|
|
(C++11)
|
renvoie un itérateur vers la fin
(fonction membre publique de
std::basic_string<CharT,Traits,Allocator>
)
|