24 Strings library [strings]

24.4 String view classes [string.view]

24.4.2 Class template basic_­string_­view [string.view.template] Iterator support [string.view.iterators]

using const_iterator = implementation-defined;

A type that meets the requirements of a constant random access iterator ([random.access.iterators]) and of a contiguous iterator ([iterator.requirements.general]) whose value_­type is the template parameter charT.

For a basic_­string_­view str, any operation that invalidates a pointer in the range [str.data(), str.data() + str.size()) invalidates pointers, iterators, and references returned from str's member functions.

All requirements on container iterators ([container.requirements]) apply to basic_­string_­view​::​const_­iterator as well.

constexpr const_iterator begin() const noexcept; constexpr const_iterator cbegin() const noexcept;

Returns: An iterator such that

  • if !empty(), &*begin() == data_­,

  • otherwise, an unspecified value such that [begin(), end()) is a valid range.

constexpr const_iterator end() const noexcept; constexpr const_iterator cend() const noexcept;

Returns: begin() + size().

constexpr const_reverse_iterator rbegin() const noexcept; constexpr const_reverse_iterator crbegin() const noexcept;

Returns: const_­reverse_­iterator(end()).

constexpr const_reverse_iterator rend() const noexcept; constexpr const_reverse_iterator crend() const noexcept;

Returns: const_­reverse_­iterator(begin()).