array. In the Library Fundamentals TS, there is also
string_view. This paper introduces the term "contiguous iterator" as a refinement of random-access iterator, without introducing a corresponding
contiguous_iterator_tag, which was found to break code during the Issaquah discussions of Nevin Liber's paper N3884 "Contiguous Iterators: A Refinement of Random Access Iterators".
Iterators that further satisfy the requirements of output iterators are called mutable iterators. Nonmutable iterators are referred to as constant iterators.
Iterators that further satisfy the requirement that, for integral valuesChange in 21.4 [basic.string] paragraph 3:
nand dereferenceable iterator values
(a + n),
*(a + n)is equivalent to
*(addressof(*a) + n), are called contiguous iterators. [ Note: For example, the type "pointer to int" is a contiguous iterator, but
reverse_iterator<int *>is not. For a valid iterator range [a, b) with dereferenceable
a, the corresponding range denoted by pointers is [
addressof(*a) + (b - a));
bmight not be dereferenceable. -- end note ]
Delete in 21.4.1 [string.require] paragraph 4:
The iterators supported by
basic_stringare random access iterators (24.2.7 [random.access.iterators]).
Add a new paragraph after 23.2.1 [container.requirements.general] paragraph 12:
The char-like objects in a
basic_stringobject shall be stored contiguously. That is, for any
basic_stringobject s, the identity
&*(s.begin() + n) == &*s.begin() + nshall hold for all values of n such that
0 <= n < s.size().
Unless otherwise specified (either explicitly or by defining a function in terms of other functions), invoking a container member function or passing a container as an argument to a library function shall not invalidate iterators to, or change the values of, objects within that container.
A contiguous container is a container that supports random access iterators (24.2.7 [random.access.iterators]) and whose member typesChange in 220.127.116.11 [array.overview] paragraph 1:
const_iteratorare contiguous iterators (24.2.1 [iterator.requirements.general]).
... An arrayChange in 18.104.22.168 [vector.overview] paragraphs 1 and 2:
supports random access iterators. ... The elements of an array are stored contiguously, meaning that if a is an array<T, N> then it obeys the identity
&a[n] == &a + nfor all
0 <= n < N.
A vector is a sequence container thatChange in 26.6.10 [valarray.range] paragraph 1:
supports random access iterators . In addition, itsupports (amortized) constant time insert and erase operations at the end; insert and erase in the middle take linear time. ... The elements of a vector are stored contiguously, meaning that if v is a vector where T is some type otherthan bool, then it obeys the identity
&v[n] == &v + n for all 0 <= n < v.size().
A vector satisfies all of the requirements of a container and of a reversible container (given in two tables in 23.2), of a sequence container, including most of the optional sequence container requirements (23.2.3 [sequence.reqmts]),
andof an allocator-aware container (Table 99). The exceptions are ...
In the[ Drafting note: In the library fundamentals TS, section 7.4, replace
endfunction templates that follow, unspecified1 is a type that meets the requirements of a mutable random access iterator (24.2.7 [random.access.iterators]) whose
value_typeis the template parameter T and whose reference type is T&. unspecified2 is a type that meets the requirements of a constant random access iterator (24.2.7 [random.access.iterators]) whose
value_typeis the template parameter T and whose reference type is const T&.
]typedef implementation-defined const_iterator;A constant random-access iterator type
such that, for a const_iterator it, if &*(it+N) is valid, then it is equal to (&*it)+N.