class
<iterator>
std::random_access_iterator_tagstruct random_access_iterator_tag {};
Random-access iterator category
Empty class to identify the category of an iterator as a random-access iterator: Random-access iteratorsRandom-access iterators are the most complete iterators in terms of functionality. All pointer types are also valid random-access iterators.
There is not a single type of random-access iterator: Each container may define its own specific iterator type able to iterate through it and access its elements. But all random access iterators support -at least- the following operations:
property valid expressions Is default-constructible, copy-constructible, copy-assignable and destructibleX a;
X b(a);
b = a;
Can be compared for equivalence using the equality/inequality operators
a == b
a != b
Can be dereferenced as an rvalue (if in a dereferenceable state). *a
a->m
For mutable iterators (non-constant iterators):
*a = t
Can be incremented (if in a dereferenceable state).
++a
a++
*a++
Can be decremented (if a dereferenceable iterator value precedes it).
+
and -
between an iterator and an integer value, or subtracting an iterator from another. a + n
n + a
a - n
a - b
Can be compared with inequality relational operators (<
, >
, <=
and >=
). a < b
a > b
a <= b
a >= b
Supports compound assignment operations +=
and -=
a += n
a -= n
Supports the offset dereference operator ([]
) a[n]
property valid expressions Is default-constructible, copy-constructible, copy-assignable and destructible X a;
X b(a);
b = a;
Can be compared for equivalence using the equality/inequality operators
a == b
a != b
Can be dereferenced as an rvalue (if in a dereferenceable state). *a
a->m
For mutable iterators (non-constant iterators):
*a = t
Can be incremented (if in a dereferenceable state).
++a
a++
*a++
Can be decremented (if a dereferenceable iterator value precedes it).
+
and -
between an iterator and an integer value, or subtracting an iterator from another. a + n
n + a
a - n
a - b
Can be compared with inequality relational operators (<
, >
, <=
and >=
). a < b
a > b
a <= b
a >= b
Supports compound assignment operations +=
and -=
a += n
a -= n
Supports the offset dereference operator ([]
) a[n]
Lvalues are swappable. swap(a,b)
Constant iterators are iterators that do not fulfill the requirements of an output iterator; Dereferencing them yields a reference to a constant element (such as const T&
).
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4