Difference between revisions of "cpp/named req/RandomAccessIterator"
From cppreference.com
m (Text replace - "{{cpp|" to "{{c|") |
(Added operator[] to the table, as per ISO/IEC 14882:2003 24.1.5 (Table 76)) |
||
Line 36: | Line 36: | ||
|- | |- | ||
|{{c|n - i}}||{{c|It}}||{{c|i - n}}|| | |{{c|n - i}}||{{c|It}}||{{c|i - n}}|| | ||
+ | |- | ||
+ | |{{c|a[n]}}||convertible to {{c|T}}||*(a + n)|| | ||
|- | |- | ||
|{{c|a < b}}||{{c|bool}}||{{c|(a-b) > 0}} | |{{c|a < b}}||{{c|bool}}||{{c|(a-b) > 0}} | ||
Line 54: | Line 56: | ||
*{{ttb|i}}, {{ttb|a}}, {{ttb|b}} are objects of type {{ttb|It}} | *{{ttb|i}}, {{ttb|a}}, {{ttb|b}} are objects of type {{ttb|It}} | ||
*{{ttb|n}} is an integer of type {{ttb|difference_type}} | *{{ttb|n}} is an integer of type {{ttb|difference_type}} | ||
+ | *{{ttb|T}} is the iterator's value type |
Revision as of 23:19, 17 May 2012
Template:cpp/concept/title Template:cpp/concept/sidebar
An Iterator that can be moved to point to any element in constant time.
A standard pointer satisfies this concept.
Requirements
Expression | Return | Equivalent expression | Notes |
---|---|---|---|
i += n | It& | while ( n > 0 ) ++i; |
|
i + n | It | It temp = i; return i += n; | |
n + i | It | i + n | |
i -= n | It& | i += -n | |
i - n | It | i + -n | |
n - i | It | i - n | |
a[n] | convertible to T | *(a + n) | |
a < b | bool | (a-b) > 0 | Strict total ordering relation:
|
a > b | bool | b < a | |
a >= b | bool | !(a < b) | |
a <= b | bool | !(a > b) |
Table Notes
It
is the type implementing this concepti
,a
,b
are objects of typeIt
n
is an integer of typedifference_type
T
is the iterator's value type