Files
2025-10-25 03:02:53 +03:00

87 lines
3.0 KiB
Markdown
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

[string.view.iterators]
# 27 Strings library [[strings]](./#strings)
## 27.3 String view classes [[string.view]](string.view#iterators)
### 27.3.3 Class template basic_string_view [[string.view.template]](string.view.template#string.view.iterators)
#### 27.3.3.4 Iterator support [string.view.iterators]
[🔗](#lib:const_iterator,basic_string_view)
`using const_iterator = implementation-defined;
`
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/strings.tex#L928)
A type that meets the requirements
of a constant[*Cpp17RandomAccessIterator*](random.access.iterators#:Cpp17RandomAccessIterator "24.3.5.7Random access iterators[random.access.iterators]") ([[random.access.iterators]](random.access.iterators "24.3.5.7Random access iterators")),
models [contiguous_iterator](iterator.concept.contiguous#concept:contiguous_iterator "24.3.4.14Concept contiguous_­iterator[iterator.concept.contiguous]") ([[iterator.concept.contiguous]](iterator.concept.contiguous "24.3.4.14Concept contiguous_­iterator")), and
meets the constexpr iterator requirements ([[iterator.requirements.general]](iterator.requirements.general "24.3.1General")),
whose value_type is the template parameter charT[.](#1.sentence-1)
[2](#2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/strings.tex#L936)
All requirements on container iterators ([[container.requirements]](container.requirements "23.2Requirements")) apply to basic_string_view::const_iterator as well[.](#2.sentence-1)
[🔗](#lib:begin,basic_string_view)
`constexpr const_iterator begin() const noexcept;
constexpr const_iterator cbegin() const noexcept;
`
[3](#3)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/strings.tex#L948)
*Returns*: An iterator such that
- [(3.1)](#3.1)
if !empty(), addressof(*begin()) == *data_*,
- [(3.2)](#3.2)
otherwise, an unspecified value such that [begin(), end()) is a valid range[.](#3.sentence-1)
[🔗](#lib:end,basic_string_view)
`constexpr const_iterator end() const noexcept;
constexpr const_iterator cend() const noexcept;
`
[4](#4)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/strings.tex#L965)
*Returns*: begin() + size()[.](#4.sentence-1)
[🔗](#lib:rbegin,basic_string_view)
`constexpr const_reverse_iterator rbegin() const noexcept;
constexpr const_reverse_iterator crbegin() const noexcept;
`
[5](#5)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/strings.tex#L978)
*Returns*: const_reverse_iterator(end())[.](#5.sentence-1)
[🔗](#lib:rend,basic_string_view)
`constexpr const_reverse_iterator rend() const noexcept;
constexpr const_reverse_iterator crend() const noexcept;
`
[6](#6)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/strings.tex#L991)
*Returns*: const_reverse_iterator(begin())[.](#6.sentence-1)