Contiguous | β Random Access | β Bidirectional | β Forward | β Input |
β Output |
template<class X, class Y>
constexpr iter_value_t<X> iter-exchange-move(X&& x, Y&& y)
noexcept(noexcept(iter_value_t<X>(iter_move(x))) &&
noexcept(*x = iter_move(y)));
template<class S, class I>
concept sentinel_for =
semiregular<S> &&
input_or_output_iterator<I> &&
weakly-equality-comparable-with<S, I>; // see [concept.equalitycomparable]
template<class S, class I>
concept sized_sentinel_for =
sentinel_for<S, I> &&
!disable_sized_sentinel_for<remove_cv_t<S>, remove_cv_t<I>> &&
requires(const I& i, const S& s) {
{ s - i } -> same_as<iter_difference_t<I>>;
{ i - s } -> same_as<iter_difference_t<I>>;
};
template<class S, class I>
constexpr bool disable_sized_sentinel_for = false;
Expression | Return type | Operational | Assertion/note |
semantics | pre-/post-condition | ||
a != b | decltype(a != b) models boolean-testable | !(a == b) | |
*a | reference, convertible to T | ||
a->m | (*a).m | Preconditions: a is dereferenceable. | |
++r | X& | ||
(void)r++ | equivalent to (void)++r | ||
*r++ | convertible to T | { T tmp = *r; ++r; return tmp; } |
Expression | Return type | Operational | Assertion/note |
semantics | pre-/post-condition | ||
*r = o | result is not used | ||
++r | X& | ||
r++ | convertible to const X& | { X tmp = r; ++r; return tmp; } | |
*r++ = o | result is not used |
Expression | Return type | Operational | Assertion/note |
semantics | pre-/post-condition | ||
--r | X& | ||
r-- | convertible to const X& | { X tmp = r; --r; return tmp; } | |
*r-- | reference |
Expression | Return type | Operational | Assertion/note |
semantics | pre-/post-condition | ||
r += n | X& | { difference_type m = n; if (m >= 0) while (m--) ++r; else while (m++) --r; return r; } | |
a + n n + a | X | { X tmp = a; return tmp += n; } | a + n == n + a. |
r -= n | X& | return r += -n; | |
a - n | X | { X tmp = a; return tmp -= n; } | |
b - a | difference_type | return n; | |
a[n] | convertible to reference | *(a + n) | |
a < b | decltype(a < b) models boolean-testable | Effects: Equivalent to: return b - a > 0; | < is a total ordering relation |
a > b | decltype(a > b) models boolean-testable | b < a | |
a >= b | decltype(a >= b) models boolean-testable | !(a < b) | |
a <= b | decltype(a <= b) models boolean-testable | !(a > b) |