tmp/tmpte8dwcrh/{from.md → to.md}
RENAMED
|
@@ -8,38 +8,43 @@ which provides limited sequence operations because it has a fixed number
|
|
| 8 |
of elements. The library also provides container adaptors that make it
|
| 9 |
easy to construct abstract data types, such as `stack`s or `queue`s, out
|
| 10 |
of the basic sequence container kinds (or out of other kinds of sequence
|
| 11 |
containers that the user might define).
|
| 12 |
|
| 13 |
-
The sequence containers offer the programmer different
|
| 14 |
-
trade-offs and should be used accordingly. `vector`
|
| 15 |
-
type of sequence container that should be used by default. `
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
|
|
|
|
|
|
|
|
|
| 20 |
|
| 21 |
-
In Tables [[tab:
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
`X::allocator_type`
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
`
|
| 31 |
-
`
|
| 32 |
-
denotes a valid
|
| 33 |
-
denotes
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
`Args&&`.
|
| 38 |
|
| 39 |
The complexities of the expressions are sequence dependent.
|
| 40 |
|
|
|
|
|
|
|
|
|
|
| 41 |
The iterator returned from `a.insert(p, t)` points to the copy of `t`
|
| 42 |
inserted into `a`.
|
| 43 |
|
| 44 |
The iterator returned from `a.insert(p, rv)` points to the copy of `rv`
|
| 45 |
inserted into `a`.
|
|
@@ -62,12 +67,11 @@ element exists, `a.end()` is returned.
|
|
| 62 |
|
| 63 |
The iterator returned by `a.erase(q1, q2)` points to the element pointed
|
| 64 |
to by `q2` prior to any elements being erased. If no such element
|
| 65 |
exists, `a.end()` is returned.
|
| 66 |
|
| 67 |
-
For every sequence container defined in this Clause and in
|
| 68 |
-
[[strings]]:
|
| 69 |
|
| 70 |
- If the constructor
|
| 71 |
``` cpp
|
| 72 |
template<class InputIterator>
|
| 73 |
X(InputIterator first, InputIterator last,
|
|
@@ -99,14 +103,13 @@ For every sequence container defined in this Clause and in Clause
|
|
| 99 |
and a type that does not qualify as an input iterator is deduced for
|
| 100 |
that parameter, or if it has an `Allocator` template parameter and a
|
| 101 |
type that does not qualify as an allocator is deduced for that
|
| 102 |
parameter.
|
| 103 |
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
amortized constant time.
|
| 109 |
|
| 110 |
The member function `at()` provides bounds-checked access to container
|
| 111 |
elements. `at()` throws `out_of_range` if `n >= a.size()`.
|
| 112 |
|
|
|
|
| 8 |
of elements. The library also provides container adaptors that make it
|
| 9 |
easy to construct abstract data types, such as `stack`s or `queue`s, out
|
| 10 |
of the basic sequence container kinds (or out of other kinds of sequence
|
| 11 |
containers that the user might define).
|
| 12 |
|
| 13 |
+
[*Note 1*: The sequence containers offer the programmer different
|
| 14 |
+
complexity trade-offs and should be used accordingly. `vector` is the
|
| 15 |
+
type of sequence container that should be used by default. `array`
|
| 16 |
+
should be used when the container has a fixed size known during
|
| 17 |
+
translation. `list` or `forward_list` should be used when there are
|
| 18 |
+
frequent insertions and deletions from the middle of the sequence.
|
| 19 |
+
`deque` is the data structure of choice when most insertions and
|
| 20 |
+
deletions take place at the beginning or at the end of the sequence.
|
| 21 |
+
When choosing a container, remember `vector` is best; leave a comment to
|
| 22 |
+
explain if you choose from the rest! — *end note*]
|
| 23 |
|
| 24 |
+
In Tables [[tab:container.seq.req]] and [[tab:container.seq.opt]], `X`
|
| 25 |
+
denotes a sequence container class, `a` denotes a value of type `X`
|
| 26 |
+
containing elements of type `T`, `u` denotes the name of a variable
|
| 27 |
+
being declared, `A` denotes `X::allocator_type` if the *qualified-id*
|
| 28 |
+
`X::allocator_type` is valid and denotes a type [[temp.deduct]] and
|
| 29 |
+
`allocator<T>` if it doesn’t, `i` and `j` denote iterators that meet the
|
| 30 |
+
*Cpp17InputIterator* requirements and refer to elements implicitly
|
| 31 |
+
convertible to `value_type`, `[i, j)` denotes a valid range, `il`
|
| 32 |
+
designates an object of type `initializer_list<value_type>`, `n` denotes
|
| 33 |
+
a value of type `X::size_type`, `p` denotes a valid constant iterator to
|
| 34 |
+
`a`, `q` denotes a valid dereferenceable constant iterator to `a`,
|
| 35 |
+
`[q1, q2)` denotes a valid range of constant iterators in `a`, `t`
|
| 36 |
+
denotes an lvalue or a const rvalue of `X::value_type`, and `rv` denotes
|
| 37 |
+
a non-const rvalue of `X::value_type`. `Args` denotes a template
|
| 38 |
+
parameter pack; `args` denotes a function parameter pack with the
|
| 39 |
+
pattern `Args&&`.
|
|
|
|
| 40 |
|
| 41 |
The complexities of the expressions are sequence dependent.
|
| 42 |
|
| 43 |
+
[*Note 2*: `args` may directly or indirectly refer to a value in
|
| 44 |
+
`a`. — *end note*]
|
| 45 |
+
|
| 46 |
The iterator returned from `a.insert(p, t)` points to the copy of `t`
|
| 47 |
inserted into `a`.
|
| 48 |
|
| 49 |
The iterator returned from `a.insert(p, rv)` points to the copy of `rv`
|
| 50 |
inserted into `a`.
|
|
|
|
| 67 |
|
| 68 |
The iterator returned by `a.erase(q1, q2)` points to the element pointed
|
| 69 |
to by `q2` prior to any elements being erased. If no such element
|
| 70 |
exists, `a.end()` is returned.
|
| 71 |
|
| 72 |
+
For every sequence container defined in this Clause and in [[strings]]:
|
|
|
|
| 73 |
|
| 74 |
- If the constructor
|
| 75 |
``` cpp
|
| 76 |
template<class InputIterator>
|
| 77 |
X(InputIterator first, InputIterator last,
|
|
|
|
| 103 |
and a type that does not qualify as an input iterator is deduced for
|
| 104 |
that parameter, or if it has an `Allocator` template parameter and a
|
| 105 |
type that does not qualify as an allocator is deduced for that
|
| 106 |
parameter.
|
| 107 |
|
| 108 |
+
[[container.seq.opt]] lists operations that are provided for some types
|
| 109 |
+
of sequence containers but not others. An implementation shall provide
|
| 110 |
+
these operations for all container types shown in the “container”
|
| 111 |
+
column, and shall implement them so as to take amortized constant time.
|
|
|
|
| 112 |
|
| 113 |
The member function `at()` provides bounds-checked access to container
|
| 114 |
elements. `at()` throws `out_of_range` if `n >= a.size()`.
|
| 115 |
|