Name Expression Return type
Preincrement ++i X&
Postincrement (void)i++
Postincrement and dereference *i++ T
Expression semantics
Name Expression Precondition Semantics Postcondition
Dereference *t i is incrementable
Preincrement ++i i is dereferenceable i is dereferenceable or past-the-end [3] [4]
Postincrement (void)i++ i is dereferenceable Equivalent to (void)++i i is dereferenceable or past-the-end [3] [4]
Postincrement and dereference *i++ i is dereferenceable Equivalent to {T t = *i; ++i; return t;} i is dereferenceable or past-the-end [3] [4]
Complexity guarantees

All operations are amortized constant time.

Models

• istream_iterator

Notes

[1] i == j does not imply ++i == ++j.

[2] Every iterator in a valid range [i, j) is dereferenceable, and j is either dereferenceable or past-the-end. The fact that every iterator in the range is dereferenceable follows from the fact that incrementable iterators must be deferenceable.

[3] After executing ++i, it is not required that copies of the old value of i be dereferenceable or that they be in the domain of operator==.

[4] It is not guaranteed that it is possible to pass through the same input iterator twice.

See also

Output Iterator, Iterator overview

Output Iterator

Category: iterators

Component type: concept

Description

An Output Iterator is a type that provides a mechanism for storing (but not necessarily accessing) a sequence of values. Output Iterators are in some sense the converse of Input Iterators, but they have a far more restrictive interface: they do not necessarily support member access or equality, and they do not necessarily have either an associated distance type or even a value type [1]. Intuitively, one picture of an Output Iterator is a tape: you can write a value to the current location and you can advance to the next location, but you cannot read values and you cannot back up or rewind.

Refinement of

Assignable, DefaultConstructible

Associated types

None. [1]

Notation

X A type that is a model of Output Iterator

x, y Object of type X

Definitions

If x is an Output Iterator of type X, then the expression *x = t; stores the value t into x. Note that operator=, like other C++ functions, may be overloaded; it may, in fact, even be a template function. In general, then, t may be any of several different types. A type

Добавить отзыв
ВСЕ ОТЗЫВЫ О КНИГЕ В ИЗБРАННОЕ

0

Вы можете отметить интересные вам фрагменты текста, которые будут доступны по уникальной ссылке в адресной строке браузера.

Отметить Добавить цитату