Name | Expression | Precondition | Semantics | Postcondition |
Fill constructor | X(n, t) | n >= 0 | Creates a sequence with n copies of t | size() == n. Every element is a copy of t. |
Fill constructor | X a(n, t); | n >= 0 | Creates a sequence with n copies of t | a.size() == n . Every element of a is a copy of t. |
Default fill constructor | X(n) | n >= 0 | Creates a sequence of n elements initialized to a default value. | size() == n. Every element is a copy of T (). |
Default fill constructor | X a(n, t); | n >= 0 | Creates a sequence with n elements initialized to a default value. | a.size() == n. Every element of a is a copy of T(). |
Default constructor | X a; or X() | | Equivalent to X(0). | size() == 0. |
Range constructor | X(i, j) | [i,j) is a valid range. | Creates a sequence that is a copy of the range [i,j) | size() is equal to the distance from i to j. Each element is a copy of the corresponding element in the range [i,j). |
Range constructor | X a(i, j); | [i,j) is a valid range. | Creates a sequence that is a copy of the range [i,j) | a.size() is equal to the distance from i to j. Each element in a is a copy of the corresponding element in the range [i,j). |
Front | a.front() | !a.empty() | Equivalent to *(a.first()) | |
Insert | a.insert(p, t) | p is a valid iterator in a. a.size() < a.max_size() | A copy of t is inserted before p. [2] [3] | a.size() is incremented by 1. *(a.insert (p,t)) is a copy of t . The relative order of elements already in the sequence is unchanged. |
Fill insert | a.insert(p, n, t) | p is a valid iterator in a. n >= 0 && a.size() + n <= a.max_size(). | n copies of t are inserted before p. [2] [3] [4] | a.size() is incremented by n. The relative order of elements already in the sequence is unchanged. |
Range insert |