Namespaces
Variants

std::basic_string_view<CharT,Traits>::begin, std::basic_string_view<CharT,Traits>::cbegin

Depuis fr.cppreference.net
 
 
 
std::basic_string_view
 
constexpr const_iterator begin() const noexcept;
(depuis C++17)
constexpr const_iterator cbegin() const noexcept;
(depuis C++17)

Renvoie un itérateur vers le premier caractère de la vue.

Paramètres

(aucun)

Valeur de retour

const_iterator vers le premier caractère.

Complexité

Constante.

Exemple

#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)
renvoie un itérateur vers le début
(fonction membre publique de std::basic_string<CharT,Traits,Allocator> )