In the first version (with iterators), the new contents are a copy of the elements contained in the sequence between first and last (in the range [first,last)).
In the second version, the new content is the repetition n times of copies of element u.
Parameters
- first, last
- Input iterators to the initial and final positions in a sequence. The range used is [first,last), which includes all the elements between first and last, including the element pointed by first but not the element pointed by last.
The template type can be any type of input iterator. - n
- Times that u is repeated to form the new content of the object.
Member type size_type is an unsigned integral type. - u
- Value to be repeated n times as the new content of the container.
T is the first class template parameter (the type of the elements stored in the container).
Return value
noneExample
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
|
Output:
Size of first: 7 Size of second: 5 Size of third: 3 |
Complexity
Linear on initial and final sizes (destruction, copy construction).See also
| deque::operator= | Copy container content (public member function) |
