Standard Template Library Programmer's Guide
Здесь есть возможность читать онлайн «Standard Template Library Programmer's Guide» весь текст электронной книги совершенно бесплатно (целиком полную версию без сокращений). В некоторых случаях можно слушать аудио, скачать через торрент в формате fb2 и присутствует краткое содержание. Жанр: Программирование, Справочники, на английском языке. Описание произведения, (предисловие) а так же отзывы посетителей доступны на портале библиотеки ЛибКат.
- Название:Standard Template Library Programmer's Guide
- Автор:
- Жанр:
- Год:неизвестен
- ISBN:нет данных
- Рейтинг книги:4 / 5. Голосов: 1
-
Избранное:Добавить в избранное
- Отзывы:
-
Ваша оценка:
- 80
- 1
- 2
- 3
- 4
- 5
Standard Template Library Programmer's Guide: краткое содержание, описание и аннотация
Предлагаем к чтению аннотацию, описание, краткое содержание или предисловие (зависит от того, что написал сам автор книги «Standard Template Library Programmer's Guide»). Если вы не нашли необходимую информацию о книге — напишите в комментариях, мы постараемся отыскать её.
Standard Template Library Programmer's Guide — читать онлайн бесплатно полную книгу (весь текст) целиком
Ниже представлен текст книги, разбитый по страницам. Система сохранения места последней прочитанной страницы, позволяет с удобством читать онлайн бесплатно книгу «Standard Template Library Programmer's Guide», без необходимости каждый раз заново искать на чём Вы остановились. Поставьте закладку, и сможете в любой момент перейти на страницу, на которой закончили чтение.
Интервал:
Закладка:
A type that is a model of Forward Iterator may be either mutable or immutable , as defined in the Trivial Iterators requirements.
Input Iterator, Output Iterator
The same as for Input Iterator
XA type that is a model of Forward Iterator
TThe value type of X
i, j Object of type X
t Object of type T
Forward Iterator does not define any new expressions beyond those defined in Input Iterator. However, some of the restrictions described in Input Iterator are relaxed.
| Name | Expression | Return type |
|---|---|---|
| Preincrement | ++i |
X& |
| Postincrement | i++ |
X |
Forward Iterator does not define any new expressions beyond those defined in Input Iterator. However, some of the restrictions described in Input Iterator are relaxed.
| Name | Expression | Precondition | Semantics | Postcondition |
|---|---|---|---|---|
| Preincrement | ++i |
i is dereferenceable | i points to the next value | i is dereferenceable or past-the-end. &i == &++i . If i == j , then ++i == ++j . [1] |
| Postincrement | i++ |
i is dereferenceable | Equivalent to {X tmp = i; ++i; return tmp;} | i is dereferenceable or past-the-end. [1] |
The complexity of operations on Forward Iterators is guaranteed to be amortized constant time.
• T*
• hash_set::iterator
Notes
[1] The restrictions described in Input Iterator have been removed. Incrementing a forward iterator does not invalidate copies of the old value and it is guaranteed that, if i and j are dereferenceable and i == j , then ++i == ++j . As a consequence of these two facts, it is possible to pass through the same Forward Iterator twice.
Input Iterator, Output Iterator, Bidirectional Iterator, Random Access Iterator, Iterator overview
Bidirectional Iterator
Category: iterators
Component type: concept
A Bidirectional Iterator is an iterator that can be both incremented and decremented. The requirement that a Bidirectional Iterator can be decremented is the only thing that distinguishes Bidirectional Iterators from Forward Iterators.
Forward Iterator
The same as for Forward Iterator.
XA type that is a model of Bidirectional Iterator
TThe value type of X
i, jObject of type X
tObject of type T
In addition to the expressions defined in Forward Iterator, the following expressions must be valid.
| Name | Expression | Return type |
|---|---|---|
| Predecrement | --i |
X& |
| Postdecrement | i-- |
X |
Semantics of an expression is defined only where it is not defined in Forward Iterator.
| Name | Expression | Precondition | Semantics | Postcondition |
|---|---|---|---|---|
| Predecrement | --i |
i is dereferenceable or past-the-end. There exists a dereferenceable iterator j such that i == ++j . | i is modified to point to the previous element. | i is dereferenceable. &i = &--i . If i == j , then --i == --j . If j is dereferenceable and i == ++j , then --i == j . |
| Postdecrement | i-- |
i is dereferenceable or past-the-end. There exists a dereferenceable iterator j such that i == ++j . | Equivalent to { X tmp = i; --i; return tmp; } |
The complexity of operations on bidirectional iterators is guaranteed to be amortized constant time.
| Symmetry of increment and decrement | If i is dereferenceable, then ++i; --i; is a null operation. Similarly, --i; ++i; is a null operation. |
• T*
• list::iterator
Input Iterator, Output Iterator, Forward Iterator, Random Access Iterator, Iterator overview
Random Access Iterator
Category: iterators
Component type: concept
A Random Access Iterator is an iterator that provides both increment and decrement (just like a Bidirectional Iterator), and that also provides constant-time methods for moving forward and backward in arbitrary-sized steps. Random Access Iterators provide essentially all of the operations of ordinary C pointer arithmetic.
Bidirectional Iterator, LessThan Comparable
The same as for Bidirectional Iterator
XA type that is a model of Random Access Iterator
TThe value type of X
DistanceThe distance type of X
i, jObject of type X
tObject of type T
nObject of type Distance
In addition to the expressions defined in Bidirectional Iterator, the following expressions must be valid.
| Name | Expression | Type requirements | Return type |
|---|---|---|---|
| Iterator addition | i += n |
X& |
|
| Iterator addition | i + nor n + i |
X |
|
| Iterator subtraction | i –= n |
X& |
|
| Iterator subtraction | i – n |
X |
|
| Difference | i – j |
Distance |
|
| Element operator | i[n] |
Convertible to T | |
| Element assignment | i[n] = t |
X is mutable | Convertible to T |
Semantics of an expression is defined only where it differs from, or is not defined in, Bidirectional Iterator or LessThan Comparable.
| Name | Expression | Precondition | Semantics | Postcondition |
|---|---|---|---|---|
| Forward motion | i += n |
Including i itself, there must be n dereferenceable or past-the-end iterators following or preceding i , depending on whether n is positive or negative. | If n > 0 , equivalent to executing ++i n times. If n < 0 , equivalent to executing --i n times. If n == 0 , this is a null operation. [1] | i is dereferenceable or past-the-end. |
| Iterator addition | i + nor n + i |
Same as for i += n | Equivalent to { X tmp = i; return tmp += n; } . The two forms i + n and n + i are identical. | Result is dereferenceable or past-the-end |
| Iterator subtraction | i –= n |
Including i itself, there must be n dereferenceable or past-the-end iterators preceding or following i , depending on whether n is positive or negative. | Equivalent to i += (-n) . | i is dereferenceable or past-the-end. |
| Iterator subtraction | i – n |
Same as for i –= n | Equivalent to { X tmp = i; return tmp –= n; } . | Result is dereferenceable or past-the-end |
| Difference | i – j |
Either i is reachable from j or j is reachable from i , or both. | Returns a number n such that i == j + n | |
| Element operator | i[n] |
i + n exists and is dereferenceable. | Equivalent to *(i + n) [2] | |
| Element assignment | i[n] = t |
i + n exists and is dereferenceable. | Equivalent to *(i + n) = t [2] | i[n] is a copy of t . |
| Less | i < j |
Either i is reachable from j or j is reachable from i , or both. [3] | As described in LessThan Comparable [4] |
All operations on Random Access Iterators are amortized constant time. [5]
Читать дальшеИнтервал:
Закладка:
Похожие книги на «Standard Template Library Programmer's Guide»
Представляем Вашему вниманию похожие книги на «Standard Template Library Programmer's Guide» списком для выбора. Мы отобрали схожую по названию и смыслу литературу в надежде предоставить читателям больше вариантов отыскать новые, интересные, ещё непрочитанные произведения.
Обсуждение, отзывы о книге «Standard Template Library Programmer's Guide» и просто собственные мнения читателей. Оставьте ваши комментарии, напишите, что Вы думаете о произведении, его смысле или главных героях. Укажите что конкретно понравилось, а что нет, и почему Вы так считаете.