Книга: Standard Template Library Programmer
Random Access Container
Разделы на этой странице:
Random Access Container
Category: containers
Component type: concept
Description
A Random Access Container is a Reversible Container whose iterator type is a Random Access Iterator. It provides amortized constant time access to arbitrary elements.
Refinement of
Reversible Container
Associated types
No additional types beyond those defined in Reversible Container. However, the requirements for the iterator type are strengthened: it must be a Random Access Iterator.
Notation
X
A type that is a model of Random Access Container
a, b
Object of type X
T
The value type of X
Valid expressions
In addition to the expressions defined in Reversible Container, the following expressions must be valid.
Name | Expression | Type requirements | Return type |
---|---|---|---|
Element access | a[n] |
n is convertible to size_type | reference if a is mutable, const_reference otherwise |
Expression semantics
Semantics of an expression is defined only where it is not defined in Reversible Container, or where there is additional information.
Name | Expression | Precondition | Semantics |
---|---|---|---|
Element access | a[n] |
0 <= n < a.size() |
Returns the n th element from the beginning of the container. |
Complexity guarantees
The run-time complexity of element access is amortized constant time.
Invariants
Element access | The element returned by a[n] is the same as the one obtained by incrementing a.begin()n times and then dereferencing the resulting iterator. |
Models
• vector
• deque
See also
The Iterator overview, Random Access Iterator, Sequence
- Reversible Container
- Практическая работа 53. Запуск Access. Работа с объектами базы данных
- Configure Access Control
- Запуск Access. Открытие учебной базы данных Борей
- 7.5.1. Файлы .htaccess
- Основы интерфейса Access 2007
- Листинг 10.2. Пример конфигурационного файла ftpaccess
- Глава 7 Разработка баз данных в программе Access
- Урок 7.1. Знакомство с программой Access
- Access 2007 как реляционная система управления базами данных
- CHAPTER 15 Remote Access with SSH
- Accessing the Command Line