Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- constexpr iterator T_fill_insert(difference_type offset, size_type n, const T &x) {
- const auto old_size = size_;
- /* check if reallocation is needed */
- T_grow(size_ + n);
- size_ += n;
- /* get the iterator at offset */
- iterator pos = begin() + offset;
- /* we can move already initialized parts of memory
- * that we can move */
- std::move(pos,begin()+old_size-n,pos+n);
- std::uninitialized_move(pos+old_size-n, end(), end()-n);
- std::uninitialized_fill(pos, pos + n, x);
- return pos;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement