2002-06-13 00:07:53 +02:00
|
|
|
// Deque implementation (out of line) -*- C++ -*-
|
|
|
|
|
2003-01-16 21:30:50 +01:00
|
|
|
// Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
|
2002-06-13 00:07:53 +02:00
|
|
|
//
|
|
|
|
// This file is part of the GNU ISO C++ Library. This library is free
|
|
|
|
// software; you can redistribute it and/or modify it under the
|
|
|
|
// terms of the GNU General Public License as published by the
|
|
|
|
// Free Software Foundation; either version 2, or (at your option)
|
|
|
|
// any later version.
|
|
|
|
|
|
|
|
// This library is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU General Public License for more details.
|
|
|
|
|
|
|
|
// You should have received a copy of the GNU General Public License along
|
|
|
|
// with this library; see the file COPYING. If not, write to the Free
|
|
|
|
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
|
|
|
// USA.
|
|
|
|
|
|
|
|
// As a special exception, you may use this file as part of a free software
|
|
|
|
// library without restriction. Specifically, if other files instantiate
|
|
|
|
// templates or use macros or inline functions from this file, or you compile
|
|
|
|
// this file and link it with other files to produce an executable, this
|
|
|
|
// file does not by itself cause the resulting executable to be covered by
|
|
|
|
// the GNU General Public License. This exception does not however
|
|
|
|
// invalidate any other reasons why the executable file might be covered by
|
|
|
|
// the GNU General Public License.
|
|
|
|
|
|
|
|
/*
|
|
|
|
*
|
|
|
|
* Copyright (c) 1994
|
|
|
|
* Hewlett-Packard Company
|
|
|
|
*
|
|
|
|
* Permission to use, copy, modify, distribute and sell this software
|
|
|
|
* and its documentation for any purpose is hereby granted without fee,
|
|
|
|
* provided that the above copyright notice appear in all copies and
|
|
|
|
* that both that copyright notice and this permission notice appear
|
|
|
|
* in supporting documentation. Hewlett-Packard Company makes no
|
|
|
|
* representations about the suitability of this software for any
|
|
|
|
* purpose. It is provided "as is" without express or implied warranty.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* Copyright (c) 1997
|
|
|
|
* Silicon Graphics Computer Systems, Inc.
|
|
|
|
*
|
|
|
|
* Permission to use, copy, modify, distribute and sell this software
|
|
|
|
* and its documentation for any purpose is hereby granted without fee,
|
|
|
|
* provided that the above copyright notice appear in all copies and
|
|
|
|
* that both that copyright notice and this permission notice appear
|
|
|
|
* in supporting documentation. Silicon Graphics makes no
|
|
|
|
* representations about the suitability of this software for any
|
|
|
|
* purpose. It is provided "as is" without express or implied warranty.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/** @file deque.tcc
|
|
|
|
* This is an internal header file, included by other library headers.
|
|
|
|
* You should not attempt to use it directly.
|
|
|
|
*/
|
|
|
|
|
2003-07-05 06:05:45 +02:00
|
|
|
#ifndef _DEQUE_TCC
|
|
|
|
#define _DEQUE_TCC 1
|
2002-06-13 00:07:53 +02:00
|
|
|
|
|
|
|
namespace std
|
|
|
|
{
|
deque.tcc, [...]: Re-indent contents of namespace std, re-wrap comment lines as necessary.
2002-08-09 Phil Edwards <pme@gcc.gnu.org>
* include/bits/deque.tcc, include/bits/list.tcc,
include/bits/stl_deque.h, include/bits/stl_iterator_base_funcs.h,
include/bits/stl_list.h, include/bits/stl_map.h,
include/bits/stl_multimap.h, include/bits/stl_queue.h,
include/bits/stl_stack.h, include/bits/stl_vector.h,
include/bits/vector.tcc: Re-indent contents of namespace std,
re-wrap comment lines as necessary.
From-SVN: r56165
2002-08-09 18:51:15 +02:00
|
|
|
template <typename _Tp, typename _Alloc>
|
|
|
|
deque<_Tp,_Alloc>&
|
|
|
|
deque<_Tp,_Alloc>::
|
|
|
|
operator=(const deque& __x)
|
2002-06-13 00:07:53 +02:00
|
|
|
{
|
deque.tcc, [...]: Re-indent contents of namespace std, re-wrap comment lines as necessary.
2002-08-09 Phil Edwards <pme@gcc.gnu.org>
* include/bits/deque.tcc, include/bits/list.tcc,
include/bits/stl_deque.h, include/bits/stl_iterator_base_funcs.h,
include/bits/stl_list.h, include/bits/stl_map.h,
include/bits/stl_multimap.h, include/bits/stl_queue.h,
include/bits/stl_stack.h, include/bits/stl_vector.h,
include/bits/vector.tcc: Re-indent contents of namespace std,
re-wrap comment lines as necessary.
From-SVN: r56165
2002-08-09 18:51:15 +02:00
|
|
|
const size_type __len = size();
|
|
|
|
if (&__x != this)
|
2002-06-13 00:07:53 +02:00
|
|
|
{
|
deque.tcc, [...]: Re-indent contents of namespace std, re-wrap comment lines as necessary.
2002-08-09 Phil Edwards <pme@gcc.gnu.org>
* include/bits/deque.tcc, include/bits/list.tcc,
include/bits/stl_deque.h, include/bits/stl_iterator_base_funcs.h,
include/bits/stl_list.h, include/bits/stl_map.h,
include/bits/stl_multimap.h, include/bits/stl_queue.h,
include/bits/stl_stack.h, include/bits/stl_vector.h,
include/bits/vector.tcc: Re-indent contents of namespace std,
re-wrap comment lines as necessary.
From-SVN: r56165
2002-08-09 18:51:15 +02:00
|
|
|
if (__len >= __x.size())
|
2003-07-04 22:41:28 +02:00
|
|
|
erase(std::copy(__x.begin(), __x.end(), this->_M_start), this->_M_finish);
|
deque.tcc, [...]: Re-indent contents of namespace std, re-wrap comment lines as necessary.
2002-08-09 Phil Edwards <pme@gcc.gnu.org>
* include/bits/deque.tcc, include/bits/list.tcc,
include/bits/stl_deque.h, include/bits/stl_iterator_base_funcs.h,
include/bits/stl_list.h, include/bits/stl_map.h,
include/bits/stl_multimap.h, include/bits/stl_queue.h,
include/bits/stl_stack.h, include/bits/stl_vector.h,
include/bits/vector.tcc: Re-indent contents of namespace std,
re-wrap comment lines as necessary.
From-SVN: r56165
2002-08-09 18:51:15 +02:00
|
|
|
else
|
|
|
|
{
|
|
|
|
const_iterator __mid = __x.begin() + difference_type(__len);
|
2003-07-04 22:41:28 +02:00
|
|
|
std::copy(__x.begin(), __mid, this->_M_start);
|
2003-01-16 21:30:50 +01:00
|
|
|
insert(this->_M_finish, __mid, __x.end());
|
deque.tcc, [...]: Re-indent contents of namespace std, re-wrap comment lines as necessary.
2002-08-09 Phil Edwards <pme@gcc.gnu.org>
* include/bits/deque.tcc, include/bits/list.tcc,
include/bits/stl_deque.h, include/bits/stl_iterator_base_funcs.h,
include/bits/stl_list.h, include/bits/stl_map.h,
include/bits/stl_multimap.h, include/bits/stl_queue.h,
include/bits/stl_stack.h, include/bits/stl_vector.h,
include/bits/vector.tcc: Re-indent contents of namespace std,
re-wrap comment lines as necessary.
From-SVN: r56165
2002-08-09 18:51:15 +02:00
|
|
|
}
|
2002-06-13 00:07:53 +02:00
|
|
|
}
|
deque.tcc, [...]: Re-indent contents of namespace std, re-wrap comment lines as necessary.
2002-08-09 Phil Edwards <pme@gcc.gnu.org>
* include/bits/deque.tcc, include/bits/list.tcc,
include/bits/stl_deque.h, include/bits/stl_iterator_base_funcs.h,
include/bits/stl_list.h, include/bits/stl_map.h,
include/bits/stl_multimap.h, include/bits/stl_queue.h,
include/bits/stl_stack.h, include/bits/stl_vector.h,
include/bits/vector.tcc: Re-indent contents of namespace std,
re-wrap comment lines as necessary.
From-SVN: r56165
2002-08-09 18:51:15 +02:00
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
|
|
|
template <typename _Tp, typename _Alloc>
|
|
|
|
typename deque<_Tp,_Alloc>::iterator
|
|
|
|
deque<_Tp,_Alloc>::
|
|
|
|
insert(iterator position, const value_type& __x)
|
2002-06-13 00:07:53 +02:00
|
|
|
{
|
2003-01-16 21:30:50 +01:00
|
|
|
if (position._M_cur == this->_M_start._M_cur)
|
2002-06-13 00:07:53 +02:00
|
|
|
{
|
deque.tcc, [...]: Re-indent contents of namespace std, re-wrap comment lines as necessary.
2002-08-09 Phil Edwards <pme@gcc.gnu.org>
* include/bits/deque.tcc, include/bits/list.tcc,
include/bits/stl_deque.h, include/bits/stl_iterator_base_funcs.h,
include/bits/stl_list.h, include/bits/stl_map.h,
include/bits/stl_multimap.h, include/bits/stl_queue.h,
include/bits/stl_stack.h, include/bits/stl_vector.h,
include/bits/vector.tcc: Re-indent contents of namespace std,
re-wrap comment lines as necessary.
From-SVN: r56165
2002-08-09 18:51:15 +02:00
|
|
|
push_front(__x);
|
2003-01-16 21:30:50 +01:00
|
|
|
return this->_M_start;
|
2002-06-13 00:07:53 +02:00
|
|
|
}
|
2003-01-16 21:30:50 +01:00
|
|
|
else if (position._M_cur == this->_M_finish._M_cur)
|
2002-06-13 00:07:53 +02:00
|
|
|
{
|
deque.tcc, [...]: Re-indent contents of namespace std, re-wrap comment lines as necessary.
2002-08-09 Phil Edwards <pme@gcc.gnu.org>
* include/bits/deque.tcc, include/bits/list.tcc,
include/bits/stl_deque.h, include/bits/stl_iterator_base_funcs.h,
include/bits/stl_list.h, include/bits/stl_map.h,
include/bits/stl_multimap.h, include/bits/stl_queue.h,
include/bits/stl_stack.h, include/bits/stl_vector.h,
include/bits/vector.tcc: Re-indent contents of namespace std,
re-wrap comment lines as necessary.
From-SVN: r56165
2002-08-09 18:51:15 +02:00
|
|
|
push_back(__x);
|
2003-01-16 21:30:50 +01:00
|
|
|
iterator __tmp = this->_M_finish;
|
deque.tcc, [...]: Re-indent contents of namespace std, re-wrap comment lines as necessary.
2002-08-09 Phil Edwards <pme@gcc.gnu.org>
* include/bits/deque.tcc, include/bits/list.tcc,
include/bits/stl_deque.h, include/bits/stl_iterator_base_funcs.h,
include/bits/stl_list.h, include/bits/stl_map.h,
include/bits/stl_multimap.h, include/bits/stl_queue.h,
include/bits/stl_stack.h, include/bits/stl_vector.h,
include/bits/vector.tcc: Re-indent contents of namespace std,
re-wrap comment lines as necessary.
From-SVN: r56165
2002-08-09 18:51:15 +02:00
|
|
|
--__tmp;
|
|
|
|
return __tmp;
|
2002-06-13 00:07:53 +02:00
|
|
|
}
|
|
|
|
else
|
deque.tcc, [...]: Re-indent contents of namespace std, re-wrap comment lines as necessary.
2002-08-09 Phil Edwards <pme@gcc.gnu.org>
* include/bits/deque.tcc, include/bits/list.tcc,
include/bits/stl_deque.h, include/bits/stl_iterator_base_funcs.h,
include/bits/stl_list.h, include/bits/stl_map.h,
include/bits/stl_multimap.h, include/bits/stl_queue.h,
include/bits/stl_stack.h, include/bits/stl_vector.h,
include/bits/vector.tcc: Re-indent contents of namespace std,
re-wrap comment lines as necessary.
From-SVN: r56165
2002-08-09 18:51:15 +02:00
|
|
|
return _M_insert_aux(position, __x);
|
2002-06-13 00:07:53 +02:00
|
|
|
}
|
|
|
|
|
deque.tcc, [...]: Re-indent contents of namespace std, re-wrap comment lines as necessary.
2002-08-09 Phil Edwards <pme@gcc.gnu.org>
* include/bits/deque.tcc, include/bits/list.tcc,
include/bits/stl_deque.h, include/bits/stl_iterator_base_funcs.h,
include/bits/stl_list.h, include/bits/stl_map.h,
include/bits/stl_multimap.h, include/bits/stl_queue.h,
include/bits/stl_stack.h, include/bits/stl_vector.h,
include/bits/vector.tcc: Re-indent contents of namespace std,
re-wrap comment lines as necessary.
From-SVN: r56165
2002-08-09 18:51:15 +02:00
|
|
|
template <typename _Tp, typename _Alloc>
|
|
|
|
typename deque<_Tp,_Alloc>::iterator
|
|
|
|
deque<_Tp,_Alloc>::
|
|
|
|
erase(iterator __position)
|
2002-06-13 00:07:53 +02:00
|
|
|
{
|
deque.tcc, [...]: Re-indent contents of namespace std, re-wrap comment lines as necessary.
2002-08-09 Phil Edwards <pme@gcc.gnu.org>
* include/bits/deque.tcc, include/bits/list.tcc,
include/bits/stl_deque.h, include/bits/stl_iterator_base_funcs.h,
include/bits/stl_list.h, include/bits/stl_map.h,
include/bits/stl_multimap.h, include/bits/stl_queue.h,
include/bits/stl_stack.h, include/bits/stl_vector.h,
include/bits/vector.tcc: Re-indent contents of namespace std,
re-wrap comment lines as necessary.
From-SVN: r56165
2002-08-09 18:51:15 +02:00
|
|
|
iterator __next = __position;
|
|
|
|
++__next;
|
2003-01-16 21:30:50 +01:00
|
|
|
size_type __index = __position - this->_M_start;
|
deque.tcc, [...]: Re-indent contents of namespace std, re-wrap comment lines as necessary.
2002-08-09 Phil Edwards <pme@gcc.gnu.org>
* include/bits/deque.tcc, include/bits/list.tcc,
include/bits/stl_deque.h, include/bits/stl_iterator_base_funcs.h,
include/bits/stl_list.h, include/bits/stl_map.h,
include/bits/stl_multimap.h, include/bits/stl_queue.h,
include/bits/stl_stack.h, include/bits/stl_vector.h,
include/bits/vector.tcc: Re-indent contents of namespace std,
re-wrap comment lines as necessary.
From-SVN: r56165
2002-08-09 18:51:15 +02:00
|
|
|
if (__index < (size() >> 1))
|
2002-06-13 00:07:53 +02:00
|
|
|
{
|
2003-07-04 22:41:28 +02:00
|
|
|
std::copy_backward(this->_M_start, __position, __next);
|
deque.tcc, [...]: Re-indent contents of namespace std, re-wrap comment lines as necessary.
2002-08-09 Phil Edwards <pme@gcc.gnu.org>
* include/bits/deque.tcc, include/bits/list.tcc,
include/bits/stl_deque.h, include/bits/stl_iterator_base_funcs.h,
include/bits/stl_list.h, include/bits/stl_map.h,
include/bits/stl_multimap.h, include/bits/stl_queue.h,
include/bits/stl_stack.h, include/bits/stl_vector.h,
include/bits/vector.tcc: Re-indent contents of namespace std,
re-wrap comment lines as necessary.
From-SVN: r56165
2002-08-09 18:51:15 +02:00
|
|
|
pop_front();
|
2002-06-13 00:07:53 +02:00
|
|
|
}
|
deque.tcc, [...]: Re-indent contents of namespace std, re-wrap comment lines as necessary.
2002-08-09 Phil Edwards <pme@gcc.gnu.org>
* include/bits/deque.tcc, include/bits/list.tcc,
include/bits/stl_deque.h, include/bits/stl_iterator_base_funcs.h,
include/bits/stl_list.h, include/bits/stl_map.h,
include/bits/stl_multimap.h, include/bits/stl_queue.h,
include/bits/stl_stack.h, include/bits/stl_vector.h,
include/bits/vector.tcc: Re-indent contents of namespace std,
re-wrap comment lines as necessary.
From-SVN: r56165
2002-08-09 18:51:15 +02:00
|
|
|
else
|
2002-06-13 00:07:53 +02:00
|
|
|
{
|
2003-07-04 22:41:28 +02:00
|
|
|
std::copy(__next, this->_M_finish, __position);
|
deque.tcc, [...]: Re-indent contents of namespace std, re-wrap comment lines as necessary.
2002-08-09 Phil Edwards <pme@gcc.gnu.org>
* include/bits/deque.tcc, include/bits/list.tcc,
include/bits/stl_deque.h, include/bits/stl_iterator_base_funcs.h,
include/bits/stl_list.h, include/bits/stl_map.h,
include/bits/stl_multimap.h, include/bits/stl_queue.h,
include/bits/stl_stack.h, include/bits/stl_vector.h,
include/bits/vector.tcc: Re-indent contents of namespace std,
re-wrap comment lines as necessary.
From-SVN: r56165
2002-08-09 18:51:15 +02:00
|
|
|
pop_back();
|
2002-06-13 00:07:53 +02:00
|
|
|
}
|
2003-01-16 21:30:50 +01:00
|
|
|
return this->_M_start + __index;
|
deque.tcc, [...]: Re-indent contents of namespace std, re-wrap comment lines as necessary.
2002-08-09 Phil Edwards <pme@gcc.gnu.org>
* include/bits/deque.tcc, include/bits/list.tcc,
include/bits/stl_deque.h, include/bits/stl_iterator_base_funcs.h,
include/bits/stl_list.h, include/bits/stl_map.h,
include/bits/stl_multimap.h, include/bits/stl_queue.h,
include/bits/stl_stack.h, include/bits/stl_vector.h,
include/bits/vector.tcc: Re-indent contents of namespace std,
re-wrap comment lines as necessary.
From-SVN: r56165
2002-08-09 18:51:15 +02:00
|
|
|
}
|
2002-06-13 00:07:53 +02:00
|
|
|
|
deque.tcc, [...]: Re-indent contents of namespace std, re-wrap comment lines as necessary.
2002-08-09 Phil Edwards <pme@gcc.gnu.org>
* include/bits/deque.tcc, include/bits/list.tcc,
include/bits/stl_deque.h, include/bits/stl_iterator_base_funcs.h,
include/bits/stl_list.h, include/bits/stl_map.h,
include/bits/stl_multimap.h, include/bits/stl_queue.h,
include/bits/stl_stack.h, include/bits/stl_vector.h,
include/bits/vector.tcc: Re-indent contents of namespace std,
re-wrap comment lines as necessary.
From-SVN: r56165
2002-08-09 18:51:15 +02:00
|
|
|
template <typename _Tp, typename _Alloc>
|
|
|
|
typename deque<_Tp,_Alloc>::iterator
|
2002-06-13 00:07:53 +02:00
|
|
|
deque<_Tp,_Alloc>::
|
deque.tcc, [...]: Re-indent contents of namespace std, re-wrap comment lines as necessary.
2002-08-09 Phil Edwards <pme@gcc.gnu.org>
* include/bits/deque.tcc, include/bits/list.tcc,
include/bits/stl_deque.h, include/bits/stl_iterator_base_funcs.h,
include/bits/stl_list.h, include/bits/stl_map.h,
include/bits/stl_multimap.h, include/bits/stl_queue.h,
include/bits/stl_stack.h, include/bits/stl_vector.h,
include/bits/vector.tcc: Re-indent contents of namespace std,
re-wrap comment lines as necessary.
From-SVN: r56165
2002-08-09 18:51:15 +02:00
|
|
|
erase(iterator __first, iterator __last)
|
2002-06-13 00:07:53 +02:00
|
|
|
{
|
2003-01-16 21:30:50 +01:00
|
|
|
if (__first == this->_M_start && __last == this->_M_finish)
|
deque.tcc, [...]: Re-indent contents of namespace std, re-wrap comment lines as necessary.
2002-08-09 Phil Edwards <pme@gcc.gnu.org>
* include/bits/deque.tcc, include/bits/list.tcc,
include/bits/stl_deque.h, include/bits/stl_iterator_base_funcs.h,
include/bits/stl_list.h, include/bits/stl_map.h,
include/bits/stl_multimap.h, include/bits/stl_queue.h,
include/bits/stl_stack.h, include/bits/stl_vector.h,
include/bits/vector.tcc: Re-indent contents of namespace std,
re-wrap comment lines as necessary.
From-SVN: r56165
2002-08-09 18:51:15 +02:00
|
|
|
{
|
|
|
|
clear();
|
2003-01-16 21:30:50 +01:00
|
|
|
return this->_M_finish;
|
deque.tcc, [...]: Re-indent contents of namespace std, re-wrap comment lines as necessary.
2002-08-09 Phil Edwards <pme@gcc.gnu.org>
* include/bits/deque.tcc, include/bits/list.tcc,
include/bits/stl_deque.h, include/bits/stl_iterator_base_funcs.h,
include/bits/stl_list.h, include/bits/stl_map.h,
include/bits/stl_multimap.h, include/bits/stl_queue.h,
include/bits/stl_stack.h, include/bits/stl_vector.h,
include/bits/vector.tcc: Re-indent contents of namespace std,
re-wrap comment lines as necessary.
From-SVN: r56165
2002-08-09 18:51:15 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
difference_type __n = __last - __first;
|
2003-01-16 21:30:50 +01:00
|
|
|
difference_type __elems_before = __first - this->_M_start;
|
deque.tcc, [...]: Re-indent contents of namespace std, re-wrap comment lines as necessary.
2002-08-09 Phil Edwards <pme@gcc.gnu.org>
* include/bits/deque.tcc, include/bits/list.tcc,
include/bits/stl_deque.h, include/bits/stl_iterator_base_funcs.h,
include/bits/stl_list.h, include/bits/stl_map.h,
include/bits/stl_multimap.h, include/bits/stl_queue.h,
include/bits/stl_stack.h, include/bits/stl_vector.h,
include/bits/vector.tcc: Re-indent contents of namespace std,
re-wrap comment lines as necessary.
From-SVN: r56165
2002-08-09 18:51:15 +02:00
|
|
|
if (static_cast<size_type>(__elems_before) < (size() - __n) / 2)
|
2002-06-13 00:07:53 +02:00
|
|
|
{
|
2003-07-04 22:41:28 +02:00
|
|
|
std::copy_backward(this->_M_start, __first, __last);
|
2003-01-16 21:30:50 +01:00
|
|
|
iterator __new_start = this->_M_start + __n;
|
2003-07-04 22:41:28 +02:00
|
|
|
std::_Destroy(this->_M_start, __new_start);
|
2003-01-16 21:30:50 +01:00
|
|
|
_M_destroy_nodes(this->_M_start._M_node, __new_start._M_node);
|
|
|
|
this->_M_start = __new_start;
|
2002-06-13 00:07:53 +02:00
|
|
|
}
|
deque.tcc, [...]: Re-indent contents of namespace std, re-wrap comment lines as necessary.
2002-08-09 Phil Edwards <pme@gcc.gnu.org>
* include/bits/deque.tcc, include/bits/list.tcc,
include/bits/stl_deque.h, include/bits/stl_iterator_base_funcs.h,
include/bits/stl_list.h, include/bits/stl_map.h,
include/bits/stl_multimap.h, include/bits/stl_queue.h,
include/bits/stl_stack.h, include/bits/stl_vector.h,
include/bits/vector.tcc: Re-indent contents of namespace std,
re-wrap comment lines as necessary.
From-SVN: r56165
2002-08-09 18:51:15 +02:00
|
|
|
else
|
2002-06-13 00:07:53 +02:00
|
|
|
{
|
2003-07-04 22:41:28 +02:00
|
|
|
std::copy(__last, this->_M_finish, __first);
|
2003-01-16 21:30:50 +01:00
|
|
|
iterator __new_finish = this->_M_finish - __n;
|
2003-07-04 22:41:28 +02:00
|
|
|
std::_Destroy(__new_finish, this->_M_finish);
|
2003-01-16 21:30:50 +01:00
|
|
|
_M_destroy_nodes(__new_finish._M_node + 1,
|
|
|
|
this->_M_finish._M_node + 1);
|
|
|
|
this->_M_finish = __new_finish;
|
2002-06-13 00:07:53 +02:00
|
|
|
}
|
2003-01-16 21:30:50 +01:00
|
|
|
return this->_M_start + __elems_before;
|
deque.tcc, [...]: Re-indent contents of namespace std, re-wrap comment lines as necessary.
2002-08-09 Phil Edwards <pme@gcc.gnu.org>
* include/bits/deque.tcc, include/bits/list.tcc,
include/bits/stl_deque.h, include/bits/stl_iterator_base_funcs.h,
include/bits/stl_list.h, include/bits/stl_map.h,
include/bits/stl_multimap.h, include/bits/stl_queue.h,
include/bits/stl_stack.h, include/bits/stl_vector.h,
include/bits/vector.tcc: Re-indent contents of namespace std,
re-wrap comment lines as necessary.
From-SVN: r56165
2002-08-09 18:51:15 +02:00
|
|
|
}
|
2002-06-13 00:07:53 +02:00
|
|
|
}
|
deque.tcc, [...]: Re-indent contents of namespace std, re-wrap comment lines as necessary.
2002-08-09 Phil Edwards <pme@gcc.gnu.org>
* include/bits/deque.tcc, include/bits/list.tcc,
include/bits/stl_deque.h, include/bits/stl_iterator_base_funcs.h,
include/bits/stl_list.h, include/bits/stl_map.h,
include/bits/stl_multimap.h, include/bits/stl_queue.h,
include/bits/stl_stack.h, include/bits/stl_vector.h,
include/bits/vector.tcc: Re-indent contents of namespace std,
re-wrap comment lines as necessary.
From-SVN: r56165
2002-08-09 18:51:15 +02:00
|
|
|
|
|
|
|
template <typename _Tp, typename _Alloc>
|
2002-06-13 00:07:53 +02:00
|
|
|
void
|
|
|
|
deque<_Tp,_Alloc>::
|
deque.tcc, [...]: Re-indent contents of namespace std, re-wrap comment lines as necessary.
2002-08-09 Phil Edwards <pme@gcc.gnu.org>
* include/bits/deque.tcc, include/bits/list.tcc,
include/bits/stl_deque.h, include/bits/stl_iterator_base_funcs.h,
include/bits/stl_list.h, include/bits/stl_map.h,
include/bits/stl_multimap.h, include/bits/stl_queue.h,
include/bits/stl_stack.h, include/bits/stl_vector.h,
include/bits/vector.tcc: Re-indent contents of namespace std,
re-wrap comment lines as necessary.
From-SVN: r56165
2002-08-09 18:51:15 +02:00
|
|
|
clear()
|
2002-06-13 00:07:53 +02:00
|
|
|
{
|
2003-01-16 21:30:50 +01:00
|
|
|
for (_Map_pointer __node = this->_M_start._M_node + 1;
|
|
|
|
__node < this->_M_finish._M_node;
|
deque.tcc, [...]: Re-indent contents of namespace std, re-wrap comment lines as necessary.
2002-08-09 Phil Edwards <pme@gcc.gnu.org>
* include/bits/deque.tcc, include/bits/list.tcc,
include/bits/stl_deque.h, include/bits/stl_iterator_base_funcs.h,
include/bits/stl_list.h, include/bits/stl_map.h,
include/bits/stl_multimap.h, include/bits/stl_queue.h,
include/bits/stl_stack.h, include/bits/stl_vector.h,
include/bits/vector.tcc: Re-indent contents of namespace std,
re-wrap comment lines as necessary.
From-SVN: r56165
2002-08-09 18:51:15 +02:00
|
|
|
++__node)
|
2002-06-13 00:07:53 +02:00
|
|
|
{
|
2003-07-04 22:41:28 +02:00
|
|
|
std::_Destroy(*__node, *__node + _S_buffer_size());
|
deque.tcc, [...]: Re-indent contents of namespace std, re-wrap comment lines as necessary.
2002-08-09 Phil Edwards <pme@gcc.gnu.org>
* include/bits/deque.tcc, include/bits/list.tcc,
include/bits/stl_deque.h, include/bits/stl_iterator_base_funcs.h,
include/bits/stl_list.h, include/bits/stl_map.h,
include/bits/stl_multimap.h, include/bits/stl_queue.h,
include/bits/stl_stack.h, include/bits/stl_vector.h,
include/bits/vector.tcc: Re-indent contents of namespace std,
re-wrap comment lines as necessary.
From-SVN: r56165
2002-08-09 18:51:15 +02:00
|
|
|
_M_deallocate_node(*__node);
|
2002-06-13 00:07:53 +02:00
|
|
|
}
|
deque.tcc, [...]: Re-indent contents of namespace std, re-wrap comment lines as necessary.
2002-08-09 Phil Edwards <pme@gcc.gnu.org>
* include/bits/deque.tcc, include/bits/list.tcc,
include/bits/stl_deque.h, include/bits/stl_iterator_base_funcs.h,
include/bits/stl_list.h, include/bits/stl_map.h,
include/bits/stl_multimap.h, include/bits/stl_queue.h,
include/bits/stl_stack.h, include/bits/stl_vector.h,
include/bits/vector.tcc: Re-indent contents of namespace std,
re-wrap comment lines as necessary.
From-SVN: r56165
2002-08-09 18:51:15 +02:00
|
|
|
|
2003-01-16 21:30:50 +01:00
|
|
|
if (this->_M_start._M_node != this->_M_finish._M_node)
|
2002-06-13 00:07:53 +02:00
|
|
|
{
|
2003-07-04 22:41:28 +02:00
|
|
|
std::_Destroy(this->_M_start._M_cur, this->_M_start._M_last);
|
|
|
|
std::_Destroy(this->_M_finish._M_first, this->_M_finish._M_cur);
|
2003-01-16 21:30:50 +01:00
|
|
|
_M_deallocate_node(this->_M_finish._M_first);
|
2002-06-13 00:07:53 +02:00
|
|
|
}
|
deque.tcc, [...]: Re-indent contents of namespace std, re-wrap comment lines as necessary.
2002-08-09 Phil Edwards <pme@gcc.gnu.org>
* include/bits/deque.tcc, include/bits/list.tcc,
include/bits/stl_deque.h, include/bits/stl_iterator_base_funcs.h,
include/bits/stl_list.h, include/bits/stl_map.h,
include/bits/stl_multimap.h, include/bits/stl_queue.h,
include/bits/stl_stack.h, include/bits/stl_vector.h,
include/bits/vector.tcc: Re-indent contents of namespace std,
re-wrap comment lines as necessary.
From-SVN: r56165
2002-08-09 18:51:15 +02:00
|
|
|
else
|
2003-07-04 22:41:28 +02:00
|
|
|
std::_Destroy(this->_M_start._M_cur, this->_M_finish._M_cur);
|
deque.tcc, [...]: Re-indent contents of namespace std, re-wrap comment lines as necessary.
2002-08-09 Phil Edwards <pme@gcc.gnu.org>
* include/bits/deque.tcc, include/bits/list.tcc,
include/bits/stl_deque.h, include/bits/stl_iterator_base_funcs.h,
include/bits/stl_list.h, include/bits/stl_map.h,
include/bits/stl_multimap.h, include/bits/stl_queue.h,
include/bits/stl_stack.h, include/bits/stl_vector.h,
include/bits/vector.tcc: Re-indent contents of namespace std,
re-wrap comment lines as necessary.
From-SVN: r56165
2002-08-09 18:51:15 +02:00
|
|
|
|
2003-01-16 21:30:50 +01:00
|
|
|
this->_M_finish = this->_M_start;
|
deque.tcc, [...]: Re-indent contents of namespace std, re-wrap comment lines as necessary.
2002-08-09 Phil Edwards <pme@gcc.gnu.org>
* include/bits/deque.tcc, include/bits/list.tcc,
include/bits/stl_deque.h, include/bits/stl_iterator_base_funcs.h,
include/bits/stl_list.h, include/bits/stl_map.h,
include/bits/stl_multimap.h, include/bits/stl_queue.h,
include/bits/stl_stack.h, include/bits/stl_vector.h,
include/bits/vector.tcc: Re-indent contents of namespace std,
re-wrap comment lines as necessary.
From-SVN: r56165
2002-08-09 18:51:15 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
template <typename _Tp, class _Alloc>
|
BUGS: Update from 2.90.8 snapshot.
2003-06-10 Phil Edwards <pme@gcc.gnu.org>
* docs/html/17_intro/BUGS: Update from 2.90.8 snapshot.
* docs/html/17_intro/CHECKLIST: Bring up to date with respect to
correctness of container::iterator typedefs. Fix whitespace.
* docs/html/20_util/howto.html, docs/html/ext/howto.html: Add links
to allocator docs.
* docs/html/documentation.html: Regenerate.
* include/bits/basic_string.h, include/bits/basic_string.tcc,
include/bits/deque.tcc, include/bits/list.tcc, include/bits/stl_algo.h,
include/bits/stl_algobase.h, include/bits/stl_bvector.h,
include/bits/stl_deque.h, include/bits/stl_iterator_base_funcs.h,
include/bits/stl_list.h, include/bits/stl_uninitialized.h,
include/bits/stl_vector.h, include/bits/vector.tcc,
include/ext/algorithm, include/ext/slist, include/std/std_bitset.h:
Change _Iter names to _Iterator, and __pos to __position.
* include/bits/stl_relops.h, include/bits/stl_numeric.h,
include/bits/stl_multiset.h, include/bits/stl_set.h:
Remove emacs markers.
* include/bits/stl_threads.h (_STL_auto_lock): Add __unused__.
From-SVN: r67736
2003-06-10 23:52:25 +02:00
|
|
|
template <typename _InputIterator>
|
deque.tcc, [...]: Re-indent contents of namespace std, re-wrap comment lines as necessary.
2002-08-09 Phil Edwards <pme@gcc.gnu.org>
* include/bits/deque.tcc, include/bits/list.tcc,
include/bits/stl_deque.h, include/bits/stl_iterator_base_funcs.h,
include/bits/stl_list.h, include/bits/stl_map.h,
include/bits/stl_multimap.h, include/bits/stl_queue.h,
include/bits/stl_stack.h, include/bits/stl_vector.h,
include/bits/vector.tcc: Re-indent contents of namespace std,
re-wrap comment lines as necessary.
From-SVN: r56165
2002-08-09 18:51:15 +02:00
|
|
|
void
|
|
|
|
deque<_Tp,_Alloc>
|
BUGS: Update from 2.90.8 snapshot.
2003-06-10 Phil Edwards <pme@gcc.gnu.org>
* docs/html/17_intro/BUGS: Update from 2.90.8 snapshot.
* docs/html/17_intro/CHECKLIST: Bring up to date with respect to
correctness of container::iterator typedefs. Fix whitespace.
* docs/html/20_util/howto.html, docs/html/ext/howto.html: Add links
to allocator docs.
* docs/html/documentation.html: Regenerate.
* include/bits/basic_string.h, include/bits/basic_string.tcc,
include/bits/deque.tcc, include/bits/list.tcc, include/bits/stl_algo.h,
include/bits/stl_algobase.h, include/bits/stl_bvector.h,
include/bits/stl_deque.h, include/bits/stl_iterator_base_funcs.h,
include/bits/stl_list.h, include/bits/stl_uninitialized.h,
include/bits/stl_vector.h, include/bits/vector.tcc,
include/ext/algorithm, include/ext/slist, include/std/std_bitset.h:
Change _Iter names to _Iterator, and __pos to __position.
* include/bits/stl_relops.h, include/bits/stl_numeric.h,
include/bits/stl_multiset.h, include/bits/stl_set.h:
Remove emacs markers.
* include/bits/stl_threads.h (_STL_auto_lock): Add __unused__.
From-SVN: r67736
2003-06-10 23:52:25 +02:00
|
|
|
::_M_assign_aux(_InputIterator __first, _InputIterator __last, input_iterator_tag)
|
2002-06-13 00:07:53 +02:00
|
|
|
{
|
deque.tcc, [...]: Re-indent contents of namespace std, re-wrap comment lines as necessary.
2002-08-09 Phil Edwards <pme@gcc.gnu.org>
* include/bits/deque.tcc, include/bits/list.tcc,
include/bits/stl_deque.h, include/bits/stl_iterator_base_funcs.h,
include/bits/stl_list.h, include/bits/stl_map.h,
include/bits/stl_multimap.h, include/bits/stl_queue.h,
include/bits/stl_stack.h, include/bits/stl_vector.h,
include/bits/vector.tcc: Re-indent contents of namespace std,
re-wrap comment lines as necessary.
From-SVN: r56165
2002-08-09 18:51:15 +02:00
|
|
|
iterator __cur = begin();
|
|
|
|
for ( ; __first != __last && __cur != end(); ++__cur, ++__first)
|
|
|
|
*__cur = *__first;
|
|
|
|
if (__first == __last)
|
|
|
|
erase(__cur, end());
|
|
|
|
else
|
|
|
|
insert(end(), __first, __last);
|
2002-06-13 00:07:53 +02:00
|
|
|
}
|
deque.tcc, [...]: Re-indent contents of namespace std, re-wrap comment lines as necessary.
2002-08-09 Phil Edwards <pme@gcc.gnu.org>
* include/bits/deque.tcc, include/bits/list.tcc,
include/bits/stl_deque.h, include/bits/stl_iterator_base_funcs.h,
include/bits/stl_list.h, include/bits/stl_map.h,
include/bits/stl_multimap.h, include/bits/stl_queue.h,
include/bits/stl_stack.h, include/bits/stl_vector.h,
include/bits/vector.tcc: Re-indent contents of namespace std,
re-wrap comment lines as necessary.
From-SVN: r56165
2002-08-09 18:51:15 +02:00
|
|
|
|
|
|
|
template <typename _Tp, typename _Alloc>
|
2002-06-13 00:07:53 +02:00
|
|
|
void
|
|
|
|
deque<_Tp,_Alloc>::
|
deque.tcc, [...]: Re-indent contents of namespace std, re-wrap comment lines as necessary.
2002-08-09 Phil Edwards <pme@gcc.gnu.org>
* include/bits/deque.tcc, include/bits/list.tcc,
include/bits/stl_deque.h, include/bits/stl_iterator_base_funcs.h,
include/bits/stl_list.h, include/bits/stl_map.h,
include/bits/stl_multimap.h, include/bits/stl_queue.h,
include/bits/stl_stack.h, include/bits/stl_vector.h,
include/bits/vector.tcc: Re-indent contents of namespace std,
re-wrap comment lines as necessary.
From-SVN: r56165
2002-08-09 18:51:15 +02:00
|
|
|
_M_fill_insert(iterator __pos, size_type __n, const value_type& __x)
|
2002-06-13 00:07:53 +02:00
|
|
|
{
|
2003-01-16 21:30:50 +01:00
|
|
|
if (__pos._M_cur == this->_M_start._M_cur)
|
2002-06-13 00:07:53 +02:00
|
|
|
{
|
|
|
|
iterator __new_start = _M_reserve_elements_at_front(__n);
|
|
|
|
try
|
|
|
|
{
|
2003-07-04 22:41:28 +02:00
|
|
|
std::uninitialized_fill(__new_start, this->_M_start, __x);
|
2003-01-16 21:30:50 +01:00
|
|
|
this->_M_start = __new_start;
|
2002-06-13 00:07:53 +02:00
|
|
|
}
|
|
|
|
catch(...)
|
|
|
|
{
|
2003-01-16 21:30:50 +01:00
|
|
|
_M_destroy_nodes(__new_start._M_node, this->_M_start._M_node);
|
2002-06-13 00:07:53 +02:00
|
|
|
__throw_exception_again;
|
|
|
|
}
|
|
|
|
}
|
2003-01-16 21:30:50 +01:00
|
|
|
else if (__pos._M_cur == this->_M_finish._M_cur)
|
2002-06-13 00:07:53 +02:00
|
|
|
{
|
|
|
|
iterator __new_finish = _M_reserve_elements_at_back(__n);
|
|
|
|
try
|
|
|
|
{
|
2003-07-04 22:41:28 +02:00
|
|
|
std::uninitialized_fill(this->_M_finish, __new_finish, __x);
|
2003-01-16 21:30:50 +01:00
|
|
|
this->_M_finish = __new_finish;
|
2002-06-13 00:07:53 +02:00
|
|
|
}
|
|
|
|
catch(...)
|
|
|
|
{
|
2003-01-16 21:30:50 +01:00
|
|
|
_M_destroy_nodes(this->_M_finish._M_node + 1,
|
|
|
|
__new_finish._M_node + 1);
|
2002-06-13 00:07:53 +02:00
|
|
|
__throw_exception_again;
|
|
|
|
}
|
|
|
|
}
|
deque.tcc, [...]: Re-indent contents of namespace std, re-wrap comment lines as necessary.
2002-08-09 Phil Edwards <pme@gcc.gnu.org>
* include/bits/deque.tcc, include/bits/list.tcc,
include/bits/stl_deque.h, include/bits/stl_iterator_base_funcs.h,
include/bits/stl_list.h, include/bits/stl_map.h,
include/bits/stl_multimap.h, include/bits/stl_queue.h,
include/bits/stl_stack.h, include/bits/stl_vector.h,
include/bits/vector.tcc: Re-indent contents of namespace std,
re-wrap comment lines as necessary.
From-SVN: r56165
2002-08-09 18:51:15 +02:00
|
|
|
else
|
|
|
|
_M_insert_aux(__pos, __n, __x);
|
2002-06-13 00:07:53 +02:00
|
|
|
}
|
deque.tcc, [...]: Re-indent contents of namespace std, re-wrap comment lines as necessary.
2002-08-09 Phil Edwards <pme@gcc.gnu.org>
* include/bits/deque.tcc, include/bits/list.tcc,
include/bits/stl_deque.h, include/bits/stl_iterator_base_funcs.h,
include/bits/stl_list.h, include/bits/stl_map.h,
include/bits/stl_multimap.h, include/bits/stl_queue.h,
include/bits/stl_stack.h, include/bits/stl_vector.h,
include/bits/vector.tcc: Re-indent contents of namespace std,
re-wrap comment lines as necessary.
From-SVN: r56165
2002-08-09 18:51:15 +02:00
|
|
|
|
|
|
|
template <typename _Tp, typename _Alloc>
|
|
|
|
void
|
|
|
|
deque<_Tp,_Alloc>::
|
|
|
|
_M_fill_initialize(const value_type& __value)
|
2002-06-13 00:07:53 +02:00
|
|
|
{
|
deque.tcc, [...]: Re-indent contents of namespace std, re-wrap comment lines as necessary.
2002-08-09 Phil Edwards <pme@gcc.gnu.org>
* include/bits/deque.tcc, include/bits/list.tcc,
include/bits/stl_deque.h, include/bits/stl_iterator_base_funcs.h,
include/bits/stl_list.h, include/bits/stl_map.h,
include/bits/stl_multimap.h, include/bits/stl_queue.h,
include/bits/stl_stack.h, include/bits/stl_vector.h,
include/bits/vector.tcc: Re-indent contents of namespace std,
re-wrap comment lines as necessary.
From-SVN: r56165
2002-08-09 18:51:15 +02:00
|
|
|
_Map_pointer __cur;
|
|
|
|
try
|
|
|
|
{
|
2003-01-16 21:30:50 +01:00
|
|
|
for (__cur = this->_M_start._M_node;
|
|
|
|
__cur < this->_M_finish._M_node;
|
|
|
|
++__cur)
|
2003-07-04 22:41:28 +02:00
|
|
|
std::uninitialized_fill(*__cur, *__cur + _S_buffer_size(), __value);
|
|
|
|
std::uninitialized_fill(this->_M_finish._M_first,
|
|
|
|
this->_M_finish._M_cur,
|
|
|
|
__value);
|
deque.tcc, [...]: Re-indent contents of namespace std, re-wrap comment lines as necessary.
2002-08-09 Phil Edwards <pme@gcc.gnu.org>
* include/bits/deque.tcc, include/bits/list.tcc,
include/bits/stl_deque.h, include/bits/stl_iterator_base_funcs.h,
include/bits/stl_list.h, include/bits/stl_map.h,
include/bits/stl_multimap.h, include/bits/stl_queue.h,
include/bits/stl_stack.h, include/bits/stl_vector.h,
include/bits/vector.tcc: Re-indent contents of namespace std,
re-wrap comment lines as necessary.
From-SVN: r56165
2002-08-09 18:51:15 +02:00
|
|
|
}
|
|
|
|
catch(...)
|
|
|
|
{
|
2003-07-04 22:41:28 +02:00
|
|
|
std::_Destroy(this->_M_start, iterator(*__cur, __cur));
|
deque.tcc, [...]: Re-indent contents of namespace std, re-wrap comment lines as necessary.
2002-08-09 Phil Edwards <pme@gcc.gnu.org>
* include/bits/deque.tcc, include/bits/list.tcc,
include/bits/stl_deque.h, include/bits/stl_iterator_base_funcs.h,
include/bits/stl_list.h, include/bits/stl_map.h,
include/bits/stl_multimap.h, include/bits/stl_queue.h,
include/bits/stl_stack.h, include/bits/stl_vector.h,
include/bits/vector.tcc: Re-indent contents of namespace std,
re-wrap comment lines as necessary.
From-SVN: r56165
2002-08-09 18:51:15 +02:00
|
|
|
__throw_exception_again;
|
|
|
|
}
|
2002-06-13 00:07:53 +02:00
|
|
|
}
|
deque.tcc, [...]: Re-indent contents of namespace std, re-wrap comment lines as necessary.
2002-08-09 Phil Edwards <pme@gcc.gnu.org>
* include/bits/deque.tcc, include/bits/list.tcc,
include/bits/stl_deque.h, include/bits/stl_iterator_base_funcs.h,
include/bits/stl_list.h, include/bits/stl_map.h,
include/bits/stl_multimap.h, include/bits/stl_queue.h,
include/bits/stl_stack.h, include/bits/stl_vector.h,
include/bits/vector.tcc: Re-indent contents of namespace std,
re-wrap comment lines as necessary.
From-SVN: r56165
2002-08-09 18:51:15 +02:00
|
|
|
|
|
|
|
template <typename _Tp, typename _Alloc>
|
|
|
|
template <typename _InputIterator>
|
|
|
|
void
|
|
|
|
deque<_Tp,_Alloc>::
|
|
|
|
_M_range_initialize(_InputIterator __first, _InputIterator __last,
|
|
|
|
input_iterator_tag)
|
|
|
|
{
|
|
|
|
_M_initialize_map(0);
|
|
|
|
try
|
|
|
|
{
|
|
|
|
for ( ; __first != __last; ++__first)
|
|
|
|
push_back(*__first);
|
|
|
|
}
|
|
|
|
catch(...)
|
|
|
|
{
|
|
|
|
clear();
|
|
|
|
__throw_exception_again;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
template <typename _Tp, typename _Alloc>
|
|
|
|
template <typename _ForwardIterator>
|
|
|
|
void
|
|
|
|
deque<_Tp,_Alloc>::
|
|
|
|
_M_range_initialize(_ForwardIterator __first, _ForwardIterator __last,
|
|
|
|
forward_iterator_tag)
|
|
|
|
{
|
2002-12-16 19:23:00 +01:00
|
|
|
size_type __n = std::distance(__first, __last);
|
deque.tcc, [...]: Re-indent contents of namespace std, re-wrap comment lines as necessary.
2002-08-09 Phil Edwards <pme@gcc.gnu.org>
* include/bits/deque.tcc, include/bits/list.tcc,
include/bits/stl_deque.h, include/bits/stl_iterator_base_funcs.h,
include/bits/stl_list.h, include/bits/stl_map.h,
include/bits/stl_multimap.h, include/bits/stl_queue.h,
include/bits/stl_stack.h, include/bits/stl_vector.h,
include/bits/vector.tcc: Re-indent contents of namespace std,
re-wrap comment lines as necessary.
From-SVN: r56165
2002-08-09 18:51:15 +02:00
|
|
|
_M_initialize_map(__n);
|
|
|
|
|
|
|
|
_Map_pointer __cur_node;
|
|
|
|
try
|
|
|
|
{
|
2003-01-16 21:30:50 +01:00
|
|
|
for (__cur_node = this->_M_start._M_node;
|
|
|
|
__cur_node < this->_M_finish._M_node;
|
deque.tcc, [...]: Re-indent contents of namespace std, re-wrap comment lines as necessary.
2002-08-09 Phil Edwards <pme@gcc.gnu.org>
* include/bits/deque.tcc, include/bits/list.tcc,
include/bits/stl_deque.h, include/bits/stl_iterator_base_funcs.h,
include/bits/stl_list.h, include/bits/stl_map.h,
include/bits/stl_multimap.h, include/bits/stl_queue.h,
include/bits/stl_stack.h, include/bits/stl_vector.h,
include/bits/vector.tcc: Re-indent contents of namespace std,
re-wrap comment lines as necessary.
From-SVN: r56165
2002-08-09 18:51:15 +02:00
|
|
|
++__cur_node)
|
|
|
|
{
|
|
|
|
_ForwardIterator __mid = __first;
|
2003-07-04 22:41:28 +02:00
|
|
|
std::advance(__mid, _S_buffer_size());
|
|
|
|
std::uninitialized_copy(__first, __mid, *__cur_node);
|
deque.tcc, [...]: Re-indent contents of namespace std, re-wrap comment lines as necessary.
2002-08-09 Phil Edwards <pme@gcc.gnu.org>
* include/bits/deque.tcc, include/bits/list.tcc,
include/bits/stl_deque.h, include/bits/stl_iterator_base_funcs.h,
include/bits/stl_list.h, include/bits/stl_map.h,
include/bits/stl_multimap.h, include/bits/stl_queue.h,
include/bits/stl_stack.h, include/bits/stl_vector.h,
include/bits/vector.tcc: Re-indent contents of namespace std,
re-wrap comment lines as necessary.
From-SVN: r56165
2002-08-09 18:51:15 +02:00
|
|
|
__first = __mid;
|
|
|
|
}
|
2003-07-04 22:41:28 +02:00
|
|
|
std::uninitialized_copy(__first, __last, this->_M_finish._M_first);
|
deque.tcc, [...]: Re-indent contents of namespace std, re-wrap comment lines as necessary.
2002-08-09 Phil Edwards <pme@gcc.gnu.org>
* include/bits/deque.tcc, include/bits/list.tcc,
include/bits/stl_deque.h, include/bits/stl_iterator_base_funcs.h,
include/bits/stl_list.h, include/bits/stl_map.h,
include/bits/stl_multimap.h, include/bits/stl_queue.h,
include/bits/stl_stack.h, include/bits/stl_vector.h,
include/bits/vector.tcc: Re-indent contents of namespace std,
re-wrap comment lines as necessary.
From-SVN: r56165
2002-08-09 18:51:15 +02:00
|
|
|
}
|
|
|
|
catch(...)
|
|
|
|
{
|
2003-07-04 22:41:28 +02:00
|
|
|
std::_Destroy(this->_M_start, iterator(*__cur_node, __cur_node));
|
deque.tcc, [...]: Re-indent contents of namespace std, re-wrap comment lines as necessary.
2002-08-09 Phil Edwards <pme@gcc.gnu.org>
* include/bits/deque.tcc, include/bits/list.tcc,
include/bits/stl_deque.h, include/bits/stl_iterator_base_funcs.h,
include/bits/stl_list.h, include/bits/stl_map.h,
include/bits/stl_multimap.h, include/bits/stl_queue.h,
include/bits/stl_stack.h, include/bits/stl_vector.h,
include/bits/vector.tcc: Re-indent contents of namespace std,
re-wrap comment lines as necessary.
From-SVN: r56165
2002-08-09 18:51:15 +02:00
|
|
|
__throw_exception_again;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Called only if _M_finish._M_cur == _M_finish._M_last - 1.
|
|
|
|
template <typename _Tp, typename _Alloc>
|
|
|
|
void
|
|
|
|
deque<_Tp,_Alloc>::
|
|
|
|
_M_push_back_aux(const value_type& __t)
|
2002-06-13 00:07:53 +02:00
|
|
|
{
|
deque.tcc, [...]: Re-indent contents of namespace std, re-wrap comment lines as necessary.
2002-08-09 Phil Edwards <pme@gcc.gnu.org>
* include/bits/deque.tcc, include/bits/list.tcc,
include/bits/stl_deque.h, include/bits/stl_iterator_base_funcs.h,
include/bits/stl_list.h, include/bits/stl_map.h,
include/bits/stl_multimap.h, include/bits/stl_queue.h,
include/bits/stl_stack.h, include/bits/stl_vector.h,
include/bits/vector.tcc: Re-indent contents of namespace std,
re-wrap comment lines as necessary.
From-SVN: r56165
2002-08-09 18:51:15 +02:00
|
|
|
value_type __t_copy = __t;
|
|
|
|
_M_reserve_map_at_back();
|
2003-01-16 21:30:50 +01:00
|
|
|
*(this->_M_finish._M_node + 1) = _M_allocate_node();
|
deque.tcc, [...]: Re-indent contents of namespace std, re-wrap comment lines as necessary.
2002-08-09 Phil Edwards <pme@gcc.gnu.org>
* include/bits/deque.tcc, include/bits/list.tcc,
include/bits/stl_deque.h, include/bits/stl_iterator_base_funcs.h,
include/bits/stl_list.h, include/bits/stl_map.h,
include/bits/stl_multimap.h, include/bits/stl_queue.h,
include/bits/stl_stack.h, include/bits/stl_vector.h,
include/bits/vector.tcc: Re-indent contents of namespace std,
re-wrap comment lines as necessary.
From-SVN: r56165
2002-08-09 18:51:15 +02:00
|
|
|
try
|
|
|
|
{
|
2003-07-04 22:41:28 +02:00
|
|
|
std::_Construct(this->_M_finish._M_cur, __t_copy);
|
2003-01-16 21:30:50 +01:00
|
|
|
this->_M_finish._M_set_node(this->_M_finish._M_node + 1);
|
|
|
|
this->_M_finish._M_cur = this->_M_finish._M_first;
|
deque.tcc, [...]: Re-indent contents of namespace std, re-wrap comment lines as necessary.
2002-08-09 Phil Edwards <pme@gcc.gnu.org>
* include/bits/deque.tcc, include/bits/list.tcc,
include/bits/stl_deque.h, include/bits/stl_iterator_base_funcs.h,
include/bits/stl_list.h, include/bits/stl_map.h,
include/bits/stl_multimap.h, include/bits/stl_queue.h,
include/bits/stl_stack.h, include/bits/stl_vector.h,
include/bits/vector.tcc: Re-indent contents of namespace std,
re-wrap comment lines as necessary.
From-SVN: r56165
2002-08-09 18:51:15 +02:00
|
|
|
}
|
|
|
|
catch(...)
|
|
|
|
{
|
2003-01-16 21:30:50 +01:00
|
|
|
_M_deallocate_node(*(this->_M_finish._M_node + 1));
|
deque.tcc, [...]: Re-indent contents of namespace std, re-wrap comment lines as necessary.
2002-08-09 Phil Edwards <pme@gcc.gnu.org>
* include/bits/deque.tcc, include/bits/list.tcc,
include/bits/stl_deque.h, include/bits/stl_iterator_base_funcs.h,
include/bits/stl_list.h, include/bits/stl_map.h,
include/bits/stl_multimap.h, include/bits/stl_queue.h,
include/bits/stl_stack.h, include/bits/stl_vector.h,
include/bits/vector.tcc: Re-indent contents of namespace std,
re-wrap comment lines as necessary.
From-SVN: r56165
2002-08-09 18:51:15 +02:00
|
|
|
__throw_exception_again;
|
|
|
|
}
|
2002-06-13 00:07:53 +02:00
|
|
|
}
|
deque.tcc, [...]: Re-indent contents of namespace std, re-wrap comment lines as necessary.
2002-08-09 Phil Edwards <pme@gcc.gnu.org>
* include/bits/deque.tcc, include/bits/list.tcc,
include/bits/stl_deque.h, include/bits/stl_iterator_base_funcs.h,
include/bits/stl_list.h, include/bits/stl_map.h,
include/bits/stl_multimap.h, include/bits/stl_queue.h,
include/bits/stl_stack.h, include/bits/stl_vector.h,
include/bits/vector.tcc: Re-indent contents of namespace std,
re-wrap comment lines as necessary.
From-SVN: r56165
2002-08-09 18:51:15 +02:00
|
|
|
|
|
|
|
// Called only if _M_start._M_cur == _M_start._M_first.
|
|
|
|
template <typename _Tp, typename _Alloc>
|
|
|
|
void
|
|
|
|
deque<_Tp,_Alloc>::
|
|
|
|
_M_push_front_aux(const value_type& __t)
|
2002-06-13 00:07:53 +02:00
|
|
|
{
|
deque.tcc, [...]: Re-indent contents of namespace std, re-wrap comment lines as necessary.
2002-08-09 Phil Edwards <pme@gcc.gnu.org>
* include/bits/deque.tcc, include/bits/list.tcc,
include/bits/stl_deque.h, include/bits/stl_iterator_base_funcs.h,
include/bits/stl_list.h, include/bits/stl_map.h,
include/bits/stl_multimap.h, include/bits/stl_queue.h,
include/bits/stl_stack.h, include/bits/stl_vector.h,
include/bits/vector.tcc: Re-indent contents of namespace std,
re-wrap comment lines as necessary.
From-SVN: r56165
2002-08-09 18:51:15 +02:00
|
|
|
value_type __t_copy = __t;
|
|
|
|
_M_reserve_map_at_front();
|
2003-01-16 21:30:50 +01:00
|
|
|
*(this->_M_start._M_node - 1) = _M_allocate_node();
|
2002-06-13 00:07:53 +02:00
|
|
|
try
|
|
|
|
{
|
2003-01-16 21:30:50 +01:00
|
|
|
this->_M_start._M_set_node(this->_M_start._M_node - 1);
|
|
|
|
this->_M_start._M_cur = this->_M_start._M_last - 1;
|
2003-07-04 22:41:28 +02:00
|
|
|
std::_Construct(this->_M_start._M_cur, __t_copy);
|
2002-06-13 00:07:53 +02:00
|
|
|
}
|
|
|
|
catch(...)
|
deque.tcc, [...]: Re-indent contents of namespace std, re-wrap comment lines as necessary.
2002-08-09 Phil Edwards <pme@gcc.gnu.org>
* include/bits/deque.tcc, include/bits/list.tcc,
include/bits/stl_deque.h, include/bits/stl_iterator_base_funcs.h,
include/bits/stl_list.h, include/bits/stl_map.h,
include/bits/stl_multimap.h, include/bits/stl_queue.h,
include/bits/stl_stack.h, include/bits/stl_vector.h,
include/bits/vector.tcc: Re-indent contents of namespace std,
re-wrap comment lines as necessary.
From-SVN: r56165
2002-08-09 18:51:15 +02:00
|
|
|
{
|
2003-01-16 21:30:50 +01:00
|
|
|
++this->_M_start;
|
|
|
|
_M_deallocate_node(*(this->_M_start._M_node - 1));
|
2002-06-13 00:07:53 +02:00
|
|
|
__throw_exception_again;
|
|
|
|
}
|
deque.tcc, [...]: Re-indent contents of namespace std, re-wrap comment lines as necessary.
2002-08-09 Phil Edwards <pme@gcc.gnu.org>
* include/bits/deque.tcc, include/bits/list.tcc,
include/bits/stl_deque.h, include/bits/stl_iterator_base_funcs.h,
include/bits/stl_list.h, include/bits/stl_map.h,
include/bits/stl_multimap.h, include/bits/stl_queue.h,
include/bits/stl_stack.h, include/bits/stl_vector.h,
include/bits/vector.tcc: Re-indent contents of namespace std,
re-wrap comment lines as necessary.
From-SVN: r56165
2002-08-09 18:51:15 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// Called only if _M_finish._M_cur == _M_finish._M_first.
|
|
|
|
template <typename _Tp, typename _Alloc>
|
|
|
|
void deque<_Tp,_Alloc>::
|
|
|
|
_M_pop_back_aux()
|
|
|
|
{
|
2003-01-16 21:30:50 +01:00
|
|
|
_M_deallocate_node(this->_M_finish._M_first);
|
|
|
|
this->_M_finish._M_set_node(this->_M_finish._M_node - 1);
|
|
|
|
this->_M_finish._M_cur = this->_M_finish._M_last - 1;
|
2003-07-04 22:41:28 +02:00
|
|
|
std::_Destroy(this->_M_finish._M_cur);
|
2002-06-13 00:07:53 +02:00
|
|
|
}
|
deque.tcc, [...]: Re-indent contents of namespace std, re-wrap comment lines as necessary.
2002-08-09 Phil Edwards <pme@gcc.gnu.org>
* include/bits/deque.tcc, include/bits/list.tcc,
include/bits/stl_deque.h, include/bits/stl_iterator_base_funcs.h,
include/bits/stl_list.h, include/bits/stl_map.h,
include/bits/stl_multimap.h, include/bits/stl_queue.h,
include/bits/stl_stack.h, include/bits/stl_vector.h,
include/bits/vector.tcc: Re-indent contents of namespace std,
re-wrap comment lines as necessary.
From-SVN: r56165
2002-08-09 18:51:15 +02:00
|
|
|
|
|
|
|
// Called only if _M_start._M_cur == _M_start._M_last - 1. Note that
|
|
|
|
// if the deque has at least one element (a precondition for this member
|
|
|
|
// function), and if _M_start._M_cur == _M_start._M_last, then the deque
|
|
|
|
// must have at least two nodes.
|
|
|
|
template <typename _Tp, typename _Alloc>
|
|
|
|
void deque<_Tp,_Alloc>::
|
|
|
|
_M_pop_front_aux()
|
|
|
|
{
|
2003-07-04 22:41:28 +02:00
|
|
|
std::_Destroy(this->_M_start._M_cur);
|
2003-01-16 21:30:50 +01:00
|
|
|
_M_deallocate_node(this->_M_start._M_first);
|
|
|
|
this->_M_start._M_set_node(this->_M_start._M_node + 1);
|
|
|
|
this->_M_start._M_cur = this->_M_start._M_first;
|
deque.tcc, [...]: Re-indent contents of namespace std, re-wrap comment lines as necessary.
2002-08-09 Phil Edwards <pme@gcc.gnu.org>
* include/bits/deque.tcc, include/bits/list.tcc,
include/bits/stl_deque.h, include/bits/stl_iterator_base_funcs.h,
include/bits/stl_list.h, include/bits/stl_map.h,
include/bits/stl_multimap.h, include/bits/stl_queue.h,
include/bits/stl_stack.h, include/bits/stl_vector.h,
include/bits/vector.tcc: Re-indent contents of namespace std,
re-wrap comment lines as necessary.
From-SVN: r56165
2002-08-09 18:51:15 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
template <typename _Tp, typename _Alloc>
|
|
|
|
template <typename _InputIterator>
|
|
|
|
void
|
|
|
|
deque<_Tp,_Alloc>::
|
|
|
|
_M_range_insert_aux(iterator __pos,
|
|
|
|
_InputIterator __first, _InputIterator __last,
|
|
|
|
input_iterator_tag)
|
|
|
|
{
|
2003-07-04 22:41:28 +02:00
|
|
|
std::copy(__first, __last, std::inserter(*this, __pos));
|
deque.tcc, [...]: Re-indent contents of namespace std, re-wrap comment lines as necessary.
2002-08-09 Phil Edwards <pme@gcc.gnu.org>
* include/bits/deque.tcc, include/bits/list.tcc,
include/bits/stl_deque.h, include/bits/stl_iterator_base_funcs.h,
include/bits/stl_list.h, include/bits/stl_map.h,
include/bits/stl_multimap.h, include/bits/stl_queue.h,
include/bits/stl_stack.h, include/bits/stl_vector.h,
include/bits/vector.tcc: Re-indent contents of namespace std,
re-wrap comment lines as necessary.
From-SVN: r56165
2002-08-09 18:51:15 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
template <typename _Tp, typename _Alloc>
|
|
|
|
template <typename _ForwardIterator>
|
|
|
|
void
|
|
|
|
deque<_Tp,_Alloc>::
|
|
|
|
_M_range_insert_aux(iterator __pos,
|
|
|
|
_ForwardIterator __first, _ForwardIterator __last,
|
|
|
|
forward_iterator_tag)
|
|
|
|
{
|
2002-12-16 19:23:00 +01:00
|
|
|
size_type __n = std::distance(__first, __last);
|
2003-01-16 21:30:50 +01:00
|
|
|
if (__pos._M_cur == this->_M_start._M_cur)
|
deque.tcc, [...]: Re-indent contents of namespace std, re-wrap comment lines as necessary.
2002-08-09 Phil Edwards <pme@gcc.gnu.org>
* include/bits/deque.tcc, include/bits/list.tcc,
include/bits/stl_deque.h, include/bits/stl_iterator_base_funcs.h,
include/bits/stl_list.h, include/bits/stl_map.h,
include/bits/stl_multimap.h, include/bits/stl_queue.h,
include/bits/stl_stack.h, include/bits/stl_vector.h,
include/bits/vector.tcc: Re-indent contents of namespace std,
re-wrap comment lines as necessary.
From-SVN: r56165
2002-08-09 18:51:15 +02:00
|
|
|
{
|
|
|
|
iterator __new_start = _M_reserve_elements_at_front(__n);
|
|
|
|
try
|
|
|
|
{
|
2003-07-04 22:41:28 +02:00
|
|
|
std::uninitialized_copy(__first, __last, __new_start);
|
2003-01-16 21:30:50 +01:00
|
|
|
this->_M_start = __new_start;
|
deque.tcc, [...]: Re-indent contents of namespace std, re-wrap comment lines as necessary.
2002-08-09 Phil Edwards <pme@gcc.gnu.org>
* include/bits/deque.tcc, include/bits/list.tcc,
include/bits/stl_deque.h, include/bits/stl_iterator_base_funcs.h,
include/bits/stl_list.h, include/bits/stl_map.h,
include/bits/stl_multimap.h, include/bits/stl_queue.h,
include/bits/stl_stack.h, include/bits/stl_vector.h,
include/bits/vector.tcc: Re-indent contents of namespace std,
re-wrap comment lines as necessary.
From-SVN: r56165
2002-08-09 18:51:15 +02:00
|
|
|
}
|
|
|
|
catch(...)
|
|
|
|
{
|
2003-01-16 21:30:50 +01:00
|
|
|
_M_destroy_nodes(__new_start._M_node, this->_M_start._M_node);
|
deque.tcc, [...]: Re-indent contents of namespace std, re-wrap comment lines as necessary.
2002-08-09 Phil Edwards <pme@gcc.gnu.org>
* include/bits/deque.tcc, include/bits/list.tcc,
include/bits/stl_deque.h, include/bits/stl_iterator_base_funcs.h,
include/bits/stl_list.h, include/bits/stl_map.h,
include/bits/stl_multimap.h, include/bits/stl_queue.h,
include/bits/stl_stack.h, include/bits/stl_vector.h,
include/bits/vector.tcc: Re-indent contents of namespace std,
re-wrap comment lines as necessary.
From-SVN: r56165
2002-08-09 18:51:15 +02:00
|
|
|
__throw_exception_again;
|
|
|
|
}
|
|
|
|
}
|
2003-01-16 21:30:50 +01:00
|
|
|
else if (__pos._M_cur == this->_M_finish._M_cur)
|
deque.tcc, [...]: Re-indent contents of namespace std, re-wrap comment lines as necessary.
2002-08-09 Phil Edwards <pme@gcc.gnu.org>
* include/bits/deque.tcc, include/bits/list.tcc,
include/bits/stl_deque.h, include/bits/stl_iterator_base_funcs.h,
include/bits/stl_list.h, include/bits/stl_map.h,
include/bits/stl_multimap.h, include/bits/stl_queue.h,
include/bits/stl_stack.h, include/bits/stl_vector.h,
include/bits/vector.tcc: Re-indent contents of namespace std,
re-wrap comment lines as necessary.
From-SVN: r56165
2002-08-09 18:51:15 +02:00
|
|
|
{
|
|
|
|
iterator __new_finish = _M_reserve_elements_at_back(__n);
|
|
|
|
try
|
|
|
|
{
|
2003-07-04 22:41:28 +02:00
|
|
|
std::uninitialized_copy(__first, __last, this->_M_finish);
|
2003-01-16 21:30:50 +01:00
|
|
|
this->_M_finish = __new_finish;
|
deque.tcc, [...]: Re-indent contents of namespace std, re-wrap comment lines as necessary.
2002-08-09 Phil Edwards <pme@gcc.gnu.org>
* include/bits/deque.tcc, include/bits/list.tcc,
include/bits/stl_deque.h, include/bits/stl_iterator_base_funcs.h,
include/bits/stl_list.h, include/bits/stl_map.h,
include/bits/stl_multimap.h, include/bits/stl_queue.h,
include/bits/stl_stack.h, include/bits/stl_vector.h,
include/bits/vector.tcc: Re-indent contents of namespace std,
re-wrap comment lines as necessary.
From-SVN: r56165
2002-08-09 18:51:15 +02:00
|
|
|
}
|
|
|
|
catch(...)
|
|
|
|
{
|
2003-01-16 21:30:50 +01:00
|
|
|
_M_destroy_nodes(this->_M_finish._M_node + 1,
|
|
|
|
__new_finish._M_node + 1);
|
deque.tcc, [...]: Re-indent contents of namespace std, re-wrap comment lines as necessary.
2002-08-09 Phil Edwards <pme@gcc.gnu.org>
* include/bits/deque.tcc, include/bits/list.tcc,
include/bits/stl_deque.h, include/bits/stl_iterator_base_funcs.h,
include/bits/stl_list.h, include/bits/stl_map.h,
include/bits/stl_multimap.h, include/bits/stl_queue.h,
include/bits/stl_stack.h, include/bits/stl_vector.h,
include/bits/vector.tcc: Re-indent contents of namespace std,
re-wrap comment lines as necessary.
From-SVN: r56165
2002-08-09 18:51:15 +02:00
|
|
|
__throw_exception_again;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
_M_insert_aux(__pos, __first, __last, __n);
|
|
|
|
}
|
|
|
|
|
|
|
|
template <typename _Tp, typename _Alloc>
|
|
|
|
typename deque<_Tp, _Alloc>::iterator
|
|
|
|
deque<_Tp,_Alloc>::
|
|
|
|
_M_insert_aux(iterator __pos, const value_type& __x)
|
|
|
|
{
|
2003-01-16 21:30:50 +01:00
|
|
|
difference_type __index = __pos - this->_M_start;
|
deque.tcc, [...]: Re-indent contents of namespace std, re-wrap comment lines as necessary.
2002-08-09 Phil Edwards <pme@gcc.gnu.org>
* include/bits/deque.tcc, include/bits/list.tcc,
include/bits/stl_deque.h, include/bits/stl_iterator_base_funcs.h,
include/bits/stl_list.h, include/bits/stl_map.h,
include/bits/stl_multimap.h, include/bits/stl_queue.h,
include/bits/stl_stack.h, include/bits/stl_vector.h,
include/bits/vector.tcc: Re-indent contents of namespace std,
re-wrap comment lines as necessary.
From-SVN: r56165
2002-08-09 18:51:15 +02:00
|
|
|
value_type __x_copy = __x; // XXX copy
|
|
|
|
if (static_cast<size_type>(__index) < size() / 2)
|
|
|
|
{
|
|
|
|
push_front(front());
|
2003-01-16 21:30:50 +01:00
|
|
|
iterator __front1 = this->_M_start;
|
deque.tcc, [...]: Re-indent contents of namespace std, re-wrap comment lines as necessary.
2002-08-09 Phil Edwards <pme@gcc.gnu.org>
* include/bits/deque.tcc, include/bits/list.tcc,
include/bits/stl_deque.h, include/bits/stl_iterator_base_funcs.h,
include/bits/stl_list.h, include/bits/stl_map.h,
include/bits/stl_multimap.h, include/bits/stl_queue.h,
include/bits/stl_stack.h, include/bits/stl_vector.h,
include/bits/vector.tcc: Re-indent contents of namespace std,
re-wrap comment lines as necessary.
From-SVN: r56165
2002-08-09 18:51:15 +02:00
|
|
|
++__front1;
|
|
|
|
iterator __front2 = __front1;
|
|
|
|
++__front2;
|
2003-01-16 21:30:50 +01:00
|
|
|
__pos = this->_M_start + __index;
|
deque.tcc, [...]: Re-indent contents of namespace std, re-wrap comment lines as necessary.
2002-08-09 Phil Edwards <pme@gcc.gnu.org>
* include/bits/deque.tcc, include/bits/list.tcc,
include/bits/stl_deque.h, include/bits/stl_iterator_base_funcs.h,
include/bits/stl_list.h, include/bits/stl_map.h,
include/bits/stl_multimap.h, include/bits/stl_queue.h,
include/bits/stl_stack.h, include/bits/stl_vector.h,
include/bits/vector.tcc: Re-indent contents of namespace std,
re-wrap comment lines as necessary.
From-SVN: r56165
2002-08-09 18:51:15 +02:00
|
|
|
iterator __pos1 = __pos;
|
|
|
|
++__pos1;
|
2003-07-04 22:41:28 +02:00
|
|
|
std::copy(__front2, __pos1, __front1);
|
deque.tcc, [...]: Re-indent contents of namespace std, re-wrap comment lines as necessary.
2002-08-09 Phil Edwards <pme@gcc.gnu.org>
* include/bits/deque.tcc, include/bits/list.tcc,
include/bits/stl_deque.h, include/bits/stl_iterator_base_funcs.h,
include/bits/stl_list.h, include/bits/stl_map.h,
include/bits/stl_multimap.h, include/bits/stl_queue.h,
include/bits/stl_stack.h, include/bits/stl_vector.h,
include/bits/vector.tcc: Re-indent contents of namespace std,
re-wrap comment lines as necessary.
From-SVN: r56165
2002-08-09 18:51:15 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
push_back(back());
|
2003-01-16 21:30:50 +01:00
|
|
|
iterator __back1 = this->_M_finish;
|
deque.tcc, [...]: Re-indent contents of namespace std, re-wrap comment lines as necessary.
2002-08-09 Phil Edwards <pme@gcc.gnu.org>
* include/bits/deque.tcc, include/bits/list.tcc,
include/bits/stl_deque.h, include/bits/stl_iterator_base_funcs.h,
include/bits/stl_list.h, include/bits/stl_map.h,
include/bits/stl_multimap.h, include/bits/stl_queue.h,
include/bits/stl_stack.h, include/bits/stl_vector.h,
include/bits/vector.tcc: Re-indent contents of namespace std,
re-wrap comment lines as necessary.
From-SVN: r56165
2002-08-09 18:51:15 +02:00
|
|
|
--__back1;
|
|
|
|
iterator __back2 = __back1;
|
|
|
|
--__back2;
|
2003-01-16 21:30:50 +01:00
|
|
|
__pos = this->_M_start + __index;
|
2003-07-04 22:41:28 +02:00
|
|
|
std::copy_backward(__pos, __back2, __back1);
|
deque.tcc, [...]: Re-indent contents of namespace std, re-wrap comment lines as necessary.
2002-08-09 Phil Edwards <pme@gcc.gnu.org>
* include/bits/deque.tcc, include/bits/list.tcc,
include/bits/stl_deque.h, include/bits/stl_iterator_base_funcs.h,
include/bits/stl_list.h, include/bits/stl_map.h,
include/bits/stl_multimap.h, include/bits/stl_queue.h,
include/bits/stl_stack.h, include/bits/stl_vector.h,
include/bits/vector.tcc: Re-indent contents of namespace std,
re-wrap comment lines as necessary.
From-SVN: r56165
2002-08-09 18:51:15 +02:00
|
|
|
}
|
|
|
|
*__pos = __x_copy;
|
|
|
|
return __pos;
|
|
|
|
}
|
|
|
|
|
|
|
|
template <typename _Tp, typename _Alloc>
|
2002-06-13 00:07:53 +02:00
|
|
|
void
|
|
|
|
deque<_Tp,_Alloc>::
|
deque.tcc, [...]: Re-indent contents of namespace std, re-wrap comment lines as necessary.
2002-08-09 Phil Edwards <pme@gcc.gnu.org>
* include/bits/deque.tcc, include/bits/list.tcc,
include/bits/stl_deque.h, include/bits/stl_iterator_base_funcs.h,
include/bits/stl_list.h, include/bits/stl_map.h,
include/bits/stl_multimap.h, include/bits/stl_queue.h,
include/bits/stl_stack.h, include/bits/stl_vector.h,
include/bits/vector.tcc: Re-indent contents of namespace std,
re-wrap comment lines as necessary.
From-SVN: r56165
2002-08-09 18:51:15 +02:00
|
|
|
_M_insert_aux(iterator __pos, size_type __n, const value_type& __x)
|
2002-06-13 00:07:53 +02:00
|
|
|
{
|
2003-01-16 21:30:50 +01:00
|
|
|
const difference_type __elems_before = __pos - this->_M_start;
|
deque.tcc, [...]: Re-indent contents of namespace std, re-wrap comment lines as necessary.
2002-08-09 Phil Edwards <pme@gcc.gnu.org>
* include/bits/deque.tcc, include/bits/list.tcc,
include/bits/stl_deque.h, include/bits/stl_iterator_base_funcs.h,
include/bits/stl_list.h, include/bits/stl_map.h,
include/bits/stl_multimap.h, include/bits/stl_queue.h,
include/bits/stl_stack.h, include/bits/stl_vector.h,
include/bits/vector.tcc: Re-indent contents of namespace std,
re-wrap comment lines as necessary.
From-SVN: r56165
2002-08-09 18:51:15 +02:00
|
|
|
size_type __length = this->size();
|
|
|
|
value_type __x_copy = __x;
|
|
|
|
if (__elems_before < difference_type(__length / 2))
|
2002-06-13 00:07:53 +02:00
|
|
|
{
|
|
|
|
iterator __new_start = _M_reserve_elements_at_front(__n);
|
2003-01-16 21:30:50 +01:00
|
|
|
iterator __old_start = this->_M_start;
|
|
|
|
__pos = this->_M_start + __elems_before;
|
2002-06-13 00:07:53 +02:00
|
|
|
try
|
|
|
|
{
|
deque.tcc, [...]: Re-indent contents of namespace std, re-wrap comment lines as necessary.
2002-08-09 Phil Edwards <pme@gcc.gnu.org>
* include/bits/deque.tcc, include/bits/list.tcc,
include/bits/stl_deque.h, include/bits/stl_iterator_base_funcs.h,
include/bits/stl_list.h, include/bits/stl_map.h,
include/bits/stl_multimap.h, include/bits/stl_queue.h,
include/bits/stl_stack.h, include/bits/stl_vector.h,
include/bits/vector.tcc: Re-indent contents of namespace std,
re-wrap comment lines as necessary.
From-SVN: r56165
2002-08-09 18:51:15 +02:00
|
|
|
if (__elems_before >= difference_type(__n))
|
2002-06-13 00:07:53 +02:00
|
|
|
{
|
2003-01-16 21:30:50 +01:00
|
|
|
iterator __start_n = this->_M_start + difference_type(__n);
|
2003-07-04 22:41:28 +02:00
|
|
|
std::uninitialized_copy(this->_M_start, __start_n, __new_start);
|
2003-01-16 21:30:50 +01:00
|
|
|
this->_M_start = __new_start;
|
2003-07-04 22:41:28 +02:00
|
|
|
std::copy(__start_n, __pos, __old_start);
|
deque.tcc, [...]: Re-indent contents of namespace std, re-wrap comment lines as necessary.
2002-08-09 Phil Edwards <pme@gcc.gnu.org>
* include/bits/deque.tcc, include/bits/list.tcc,
include/bits/stl_deque.h, include/bits/stl_iterator_base_funcs.h,
include/bits/stl_list.h, include/bits/stl_map.h,
include/bits/stl_multimap.h, include/bits/stl_queue.h,
include/bits/stl_stack.h, include/bits/stl_vector.h,
include/bits/vector.tcc: Re-indent contents of namespace std,
re-wrap comment lines as necessary.
From-SVN: r56165
2002-08-09 18:51:15 +02:00
|
|
|
fill(__pos - difference_type(__n), __pos, __x_copy);
|
2002-06-13 00:07:53 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2003-07-04 22:41:28 +02:00
|
|
|
std::__uninitialized_copy_fill(this->_M_start, __pos, __new_start,
|
|
|
|
this->_M_start, __x_copy);
|
2003-01-16 21:30:50 +01:00
|
|
|
this->_M_start = __new_start;
|
2003-07-04 22:41:28 +02:00
|
|
|
std::fill(__old_start, __pos, __x_copy);
|
2002-06-13 00:07:53 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
catch(...)
|
deque.tcc, [...]: Re-indent contents of namespace std, re-wrap comment lines as necessary.
2002-08-09 Phil Edwards <pme@gcc.gnu.org>
* include/bits/deque.tcc, include/bits/list.tcc,
include/bits/stl_deque.h, include/bits/stl_iterator_base_funcs.h,
include/bits/stl_list.h, include/bits/stl_map.h,
include/bits/stl_multimap.h, include/bits/stl_queue.h,
include/bits/stl_stack.h, include/bits/stl_vector.h,
include/bits/vector.tcc: Re-indent contents of namespace std,
re-wrap comment lines as necessary.
From-SVN: r56165
2002-08-09 18:51:15 +02:00
|
|
|
{
|
2003-01-16 21:30:50 +01:00
|
|
|
_M_destroy_nodes(__new_start._M_node, this->_M_start._M_node);
|
2002-06-13 00:07:53 +02:00
|
|
|
__throw_exception_again;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
iterator __new_finish = _M_reserve_elements_at_back(__n);
|
2003-01-16 21:30:50 +01:00
|
|
|
iterator __old_finish = this->_M_finish;
|
deque.tcc, [...]: Re-indent contents of namespace std, re-wrap comment lines as necessary.
2002-08-09 Phil Edwards <pme@gcc.gnu.org>
* include/bits/deque.tcc, include/bits/list.tcc,
include/bits/stl_deque.h, include/bits/stl_iterator_base_funcs.h,
include/bits/stl_list.h, include/bits/stl_map.h,
include/bits/stl_multimap.h, include/bits/stl_queue.h,
include/bits/stl_stack.h, include/bits/stl_vector.h,
include/bits/vector.tcc: Re-indent contents of namespace std,
re-wrap comment lines as necessary.
From-SVN: r56165
2002-08-09 18:51:15 +02:00
|
|
|
const difference_type __elems_after =
|
|
|
|
difference_type(__length) - __elems_before;
|
2003-01-16 21:30:50 +01:00
|
|
|
__pos = this->_M_finish - __elems_after;
|
2002-06-13 00:07:53 +02:00
|
|
|
try
|
|
|
|
{
|
deque.tcc, [...]: Re-indent contents of namespace std, re-wrap comment lines as necessary.
2002-08-09 Phil Edwards <pme@gcc.gnu.org>
* include/bits/deque.tcc, include/bits/list.tcc,
include/bits/stl_deque.h, include/bits/stl_iterator_base_funcs.h,
include/bits/stl_list.h, include/bits/stl_map.h,
include/bits/stl_multimap.h, include/bits/stl_queue.h,
include/bits/stl_stack.h, include/bits/stl_vector.h,
include/bits/vector.tcc: Re-indent contents of namespace std,
re-wrap comment lines as necessary.
From-SVN: r56165
2002-08-09 18:51:15 +02:00
|
|
|
if (__elems_after > difference_type(__n))
|
2002-06-13 00:07:53 +02:00
|
|
|
{
|
2003-01-16 21:30:50 +01:00
|
|
|
iterator __finish_n = this->_M_finish - difference_type(__n);
|
2003-07-04 22:41:28 +02:00
|
|
|
std::uninitialized_copy(__finish_n, this->_M_finish, this->_M_finish);
|
2003-01-16 21:30:50 +01:00
|
|
|
this->_M_finish = __new_finish;
|
2003-07-04 22:41:28 +02:00
|
|
|
std::copy_backward(__pos, __finish_n, __old_finish);
|
|
|
|
std::fill(__pos, __pos + difference_type(__n), __x_copy);
|
2002-06-13 00:07:53 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2003-07-04 22:41:28 +02:00
|
|
|
std::__uninitialized_fill_copy(this->_M_finish,
|
|
|
|
__pos + difference_type(__n),
|
|
|
|
__x_copy, __pos, this->_M_finish);
|
2003-01-16 21:30:50 +01:00
|
|
|
this->_M_finish = __new_finish;
|
2003-07-04 22:41:28 +02:00
|
|
|
std::fill(__pos, __old_finish, __x_copy);
|
2002-06-13 00:07:53 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
catch(...)
|
deque.tcc, [...]: Re-indent contents of namespace std, re-wrap comment lines as necessary.
2002-08-09 Phil Edwards <pme@gcc.gnu.org>
* include/bits/deque.tcc, include/bits/list.tcc,
include/bits/stl_deque.h, include/bits/stl_iterator_base_funcs.h,
include/bits/stl_list.h, include/bits/stl_map.h,
include/bits/stl_multimap.h, include/bits/stl_queue.h,
include/bits/stl_stack.h, include/bits/stl_vector.h,
include/bits/vector.tcc: Re-indent contents of namespace std,
re-wrap comment lines as necessary.
From-SVN: r56165
2002-08-09 18:51:15 +02:00
|
|
|
{
|
2003-01-16 21:30:50 +01:00
|
|
|
_M_destroy_nodes(this->_M_finish._M_node + 1,
|
|
|
|
__new_finish._M_node + 1);
|
2002-06-13 00:07:53 +02:00
|
|
|
__throw_exception_again;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
deque.tcc, [...]: Re-indent contents of namespace std, re-wrap comment lines as necessary.
2002-08-09 Phil Edwards <pme@gcc.gnu.org>
* include/bits/deque.tcc, include/bits/list.tcc,
include/bits/stl_deque.h, include/bits/stl_iterator_base_funcs.h,
include/bits/stl_list.h, include/bits/stl_map.h,
include/bits/stl_multimap.h, include/bits/stl_queue.h,
include/bits/stl_stack.h, include/bits/stl_vector.h,
include/bits/vector.tcc: Re-indent contents of namespace std,
re-wrap comment lines as necessary.
From-SVN: r56165
2002-08-09 18:51:15 +02:00
|
|
|
|
|
|
|
template <typename _Tp, typename _Alloc>
|
|
|
|
template <typename _ForwardIterator>
|
|
|
|
void
|
|
|
|
deque<_Tp,_Alloc>::
|
|
|
|
_M_insert_aux(iterator __pos,
|
|
|
|
_ForwardIterator __first, _ForwardIterator __last,
|
|
|
|
size_type __n)
|
2002-06-13 00:07:53 +02:00
|
|
|
{
|
2003-01-16 21:30:50 +01:00
|
|
|
const difference_type __elemsbefore = __pos - this->_M_start;
|
deque.tcc, [...]: Re-indent contents of namespace std, re-wrap comment lines as necessary.
2002-08-09 Phil Edwards <pme@gcc.gnu.org>
* include/bits/deque.tcc, include/bits/list.tcc,
include/bits/stl_deque.h, include/bits/stl_iterator_base_funcs.h,
include/bits/stl_list.h, include/bits/stl_map.h,
include/bits/stl_multimap.h, include/bits/stl_queue.h,
include/bits/stl_stack.h, include/bits/stl_vector.h,
include/bits/vector.tcc: Re-indent contents of namespace std,
re-wrap comment lines as necessary.
From-SVN: r56165
2002-08-09 18:51:15 +02:00
|
|
|
size_type __length = size();
|
|
|
|
if (static_cast<size_type>(__elemsbefore) < __length / 2)
|
|
|
|
{
|
|
|
|
iterator __new_start = _M_reserve_elements_at_front(__n);
|
2003-01-16 21:30:50 +01:00
|
|
|
iterator __old_start = this->_M_start;
|
|
|
|
__pos = this->_M_start + __elemsbefore;
|
deque.tcc, [...]: Re-indent contents of namespace std, re-wrap comment lines as necessary.
2002-08-09 Phil Edwards <pme@gcc.gnu.org>
* include/bits/deque.tcc, include/bits/list.tcc,
include/bits/stl_deque.h, include/bits/stl_iterator_base_funcs.h,
include/bits/stl_list.h, include/bits/stl_map.h,
include/bits/stl_multimap.h, include/bits/stl_queue.h,
include/bits/stl_stack.h, include/bits/stl_vector.h,
include/bits/vector.tcc: Re-indent contents of namespace std,
re-wrap comment lines as necessary.
From-SVN: r56165
2002-08-09 18:51:15 +02:00
|
|
|
try
|
|
|
|
{
|
|
|
|
if (__elemsbefore >= difference_type(__n))
|
|
|
|
{
|
2003-01-16 21:30:50 +01:00
|
|
|
iterator __start_n = this->_M_start + difference_type(__n);
|
2003-07-04 22:41:28 +02:00
|
|
|
std::uninitialized_copy(this->_M_start, __start_n, __new_start);
|
2003-01-16 21:30:50 +01:00
|
|
|
this->_M_start = __new_start;
|
2003-07-04 22:41:28 +02:00
|
|
|
std::copy(__start_n, __pos, __old_start);
|
|
|
|
std::copy(__first, __last, __pos - difference_type(__n));
|
deque.tcc, [...]: Re-indent contents of namespace std, re-wrap comment lines as necessary.
2002-08-09 Phil Edwards <pme@gcc.gnu.org>
* include/bits/deque.tcc, include/bits/list.tcc,
include/bits/stl_deque.h, include/bits/stl_iterator_base_funcs.h,
include/bits/stl_list.h, include/bits/stl_map.h,
include/bits/stl_multimap.h, include/bits/stl_queue.h,
include/bits/stl_stack.h, include/bits/stl_vector.h,
include/bits/vector.tcc: Re-indent contents of namespace std,
re-wrap comment lines as necessary.
From-SVN: r56165
2002-08-09 18:51:15 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
_ForwardIterator __mid = __first;
|
2003-07-04 22:41:28 +02:00
|
|
|
std::advance(__mid, difference_type(__n) - __elemsbefore);
|
|
|
|
std::__uninitialized_copy_copy(this->_M_start, __pos,
|
|
|
|
__first, __mid, __new_start);
|
2003-01-16 21:30:50 +01:00
|
|
|
this->_M_start = __new_start;
|
2003-07-04 22:41:28 +02:00
|
|
|
std::copy(__mid, __last, __old_start);
|
deque.tcc, [...]: Re-indent contents of namespace std, re-wrap comment lines as necessary.
2002-08-09 Phil Edwards <pme@gcc.gnu.org>
* include/bits/deque.tcc, include/bits/list.tcc,
include/bits/stl_deque.h, include/bits/stl_iterator_base_funcs.h,
include/bits/stl_list.h, include/bits/stl_map.h,
include/bits/stl_multimap.h, include/bits/stl_queue.h,
include/bits/stl_stack.h, include/bits/stl_vector.h,
include/bits/vector.tcc: Re-indent contents of namespace std,
re-wrap comment lines as necessary.
From-SVN: r56165
2002-08-09 18:51:15 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
catch(...)
|
|
|
|
{
|
2003-01-16 21:30:50 +01:00
|
|
|
_M_destroy_nodes(__new_start._M_node, this->_M_start._M_node);
|
deque.tcc, [...]: Re-indent contents of namespace std, re-wrap comment lines as necessary.
2002-08-09 Phil Edwards <pme@gcc.gnu.org>
* include/bits/deque.tcc, include/bits/list.tcc,
include/bits/stl_deque.h, include/bits/stl_iterator_base_funcs.h,
include/bits/stl_list.h, include/bits/stl_map.h,
include/bits/stl_multimap.h, include/bits/stl_queue.h,
include/bits/stl_stack.h, include/bits/stl_vector.h,
include/bits/vector.tcc: Re-indent contents of namespace std,
re-wrap comment lines as necessary.
From-SVN: r56165
2002-08-09 18:51:15 +02:00
|
|
|
__throw_exception_again;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
iterator __new_finish = _M_reserve_elements_at_back(__n);
|
2003-01-16 21:30:50 +01:00
|
|
|
iterator __old_finish = this->_M_finish;
|
deque.tcc, [...]: Re-indent contents of namespace std, re-wrap comment lines as necessary.
2002-08-09 Phil Edwards <pme@gcc.gnu.org>
* include/bits/deque.tcc, include/bits/list.tcc,
include/bits/stl_deque.h, include/bits/stl_iterator_base_funcs.h,
include/bits/stl_list.h, include/bits/stl_map.h,
include/bits/stl_multimap.h, include/bits/stl_queue.h,
include/bits/stl_stack.h, include/bits/stl_vector.h,
include/bits/vector.tcc: Re-indent contents of namespace std,
re-wrap comment lines as necessary.
From-SVN: r56165
2002-08-09 18:51:15 +02:00
|
|
|
const difference_type __elemsafter =
|
|
|
|
difference_type(__length) - __elemsbefore;
|
2003-01-16 21:30:50 +01:00
|
|
|
__pos = this->_M_finish - __elemsafter;
|
deque.tcc, [...]: Re-indent contents of namespace std, re-wrap comment lines as necessary.
2002-08-09 Phil Edwards <pme@gcc.gnu.org>
* include/bits/deque.tcc, include/bits/list.tcc,
include/bits/stl_deque.h, include/bits/stl_iterator_base_funcs.h,
include/bits/stl_list.h, include/bits/stl_map.h,
include/bits/stl_multimap.h, include/bits/stl_queue.h,
include/bits/stl_stack.h, include/bits/stl_vector.h,
include/bits/vector.tcc: Re-indent contents of namespace std,
re-wrap comment lines as necessary.
From-SVN: r56165
2002-08-09 18:51:15 +02:00
|
|
|
try
|
|
|
|
{
|
|
|
|
if (__elemsafter > difference_type(__n))
|
|
|
|
{
|
2003-01-16 21:30:50 +01:00
|
|
|
iterator __finish_n = this->_M_finish - difference_type(__n);
|
2003-07-04 22:41:28 +02:00
|
|
|
std::uninitialized_copy(__finish_n,
|
|
|
|
this->_M_finish,
|
|
|
|
this->_M_finish);
|
2003-01-16 21:30:50 +01:00
|
|
|
this->_M_finish = __new_finish;
|
2003-07-04 22:41:28 +02:00
|
|
|
std::copy_backward(__pos, __finish_n, __old_finish);
|
|
|
|
std::copy(__first, __last, __pos);
|
deque.tcc, [...]: Re-indent contents of namespace std, re-wrap comment lines as necessary.
2002-08-09 Phil Edwards <pme@gcc.gnu.org>
* include/bits/deque.tcc, include/bits/list.tcc,
include/bits/stl_deque.h, include/bits/stl_iterator_base_funcs.h,
include/bits/stl_list.h, include/bits/stl_map.h,
include/bits/stl_multimap.h, include/bits/stl_queue.h,
include/bits/stl_stack.h, include/bits/stl_vector.h,
include/bits/vector.tcc: Re-indent contents of namespace std,
re-wrap comment lines as necessary.
From-SVN: r56165
2002-08-09 18:51:15 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
_ForwardIterator __mid = __first;
|
2003-07-04 22:41:28 +02:00
|
|
|
std::advance(__mid, __elemsafter);
|
|
|
|
std::__uninitialized_copy_copy(__mid, __last, __pos,
|
|
|
|
this->_M_finish, this->_M_finish);
|
2003-01-16 21:30:50 +01:00
|
|
|
this->_M_finish = __new_finish;
|
2003-07-04 22:41:28 +02:00
|
|
|
std::copy(__first, __mid, __pos);
|
deque.tcc, [...]: Re-indent contents of namespace std, re-wrap comment lines as necessary.
2002-08-09 Phil Edwards <pme@gcc.gnu.org>
* include/bits/deque.tcc, include/bits/list.tcc,
include/bits/stl_deque.h, include/bits/stl_iterator_base_funcs.h,
include/bits/stl_list.h, include/bits/stl_map.h,
include/bits/stl_multimap.h, include/bits/stl_queue.h,
include/bits/stl_stack.h, include/bits/stl_vector.h,
include/bits/vector.tcc: Re-indent contents of namespace std,
re-wrap comment lines as necessary.
From-SVN: r56165
2002-08-09 18:51:15 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
catch(...)
|
|
|
|
{
|
2003-01-16 21:30:50 +01:00
|
|
|
_M_destroy_nodes(this->_M_finish._M_node + 1,
|
|
|
|
__new_finish._M_node + 1);
|
deque.tcc, [...]: Re-indent contents of namespace std, re-wrap comment lines as necessary.
2002-08-09 Phil Edwards <pme@gcc.gnu.org>
* include/bits/deque.tcc, include/bits/list.tcc,
include/bits/stl_deque.h, include/bits/stl_iterator_base_funcs.h,
include/bits/stl_list.h, include/bits/stl_map.h,
include/bits/stl_multimap.h, include/bits/stl_queue.h,
include/bits/stl_stack.h, include/bits/stl_vector.h,
include/bits/vector.tcc: Re-indent contents of namespace std,
re-wrap comment lines as necessary.
From-SVN: r56165
2002-08-09 18:51:15 +02:00
|
|
|
__throw_exception_again;
|
|
|
|
}
|
|
|
|
}
|
2002-06-13 00:07:53 +02:00
|
|
|
}
|
deque.tcc, [...]: Re-indent contents of namespace std, re-wrap comment lines as necessary.
2002-08-09 Phil Edwards <pme@gcc.gnu.org>
* include/bits/deque.tcc, include/bits/list.tcc,
include/bits/stl_deque.h, include/bits/stl_iterator_base_funcs.h,
include/bits/stl_list.h, include/bits/stl_map.h,
include/bits/stl_multimap.h, include/bits/stl_queue.h,
include/bits/stl_stack.h, include/bits/stl_vector.h,
include/bits/vector.tcc: Re-indent contents of namespace std,
re-wrap comment lines as necessary.
From-SVN: r56165
2002-08-09 18:51:15 +02:00
|
|
|
|
|
|
|
template <typename _Tp, typename _Alloc>
|
|
|
|
void
|
|
|
|
deque<_Tp,_Alloc>::
|
|
|
|
_M_new_elements_at_front(size_type __new_elems)
|
|
|
|
{
|
|
|
|
size_type __new_nodes
|
|
|
|
= (__new_elems + _S_buffer_size() - 1) / _S_buffer_size();
|
|
|
|
_M_reserve_map_at_front(__new_nodes);
|
|
|
|
size_type __i;
|
|
|
|
try
|
|
|
|
{
|
|
|
|
for (__i = 1; __i <= __new_nodes; ++__i)
|
2003-01-16 21:30:50 +01:00
|
|
|
*(this->_M_start._M_node - __i) = _M_allocate_node();
|
deque.tcc, [...]: Re-indent contents of namespace std, re-wrap comment lines as necessary.
2002-08-09 Phil Edwards <pme@gcc.gnu.org>
* include/bits/deque.tcc, include/bits/list.tcc,
include/bits/stl_deque.h, include/bits/stl_iterator_base_funcs.h,
include/bits/stl_list.h, include/bits/stl_map.h,
include/bits/stl_multimap.h, include/bits/stl_queue.h,
include/bits/stl_stack.h, include/bits/stl_vector.h,
include/bits/vector.tcc: Re-indent contents of namespace std,
re-wrap comment lines as necessary.
From-SVN: r56165
2002-08-09 18:51:15 +02:00
|
|
|
}
|
|
|
|
catch(...)
|
|
|
|
{
|
|
|
|
for (size_type __j = 1; __j < __i; ++__j)
|
2003-01-16 21:30:50 +01:00
|
|
|
_M_deallocate_node(*(this->_M_start._M_node - __j));
|
deque.tcc, [...]: Re-indent contents of namespace std, re-wrap comment lines as necessary.
2002-08-09 Phil Edwards <pme@gcc.gnu.org>
* include/bits/deque.tcc, include/bits/list.tcc,
include/bits/stl_deque.h, include/bits/stl_iterator_base_funcs.h,
include/bits/stl_list.h, include/bits/stl_map.h,
include/bits/stl_multimap.h, include/bits/stl_queue.h,
include/bits/stl_stack.h, include/bits/stl_vector.h,
include/bits/vector.tcc: Re-indent contents of namespace std,
re-wrap comment lines as necessary.
From-SVN: r56165
2002-08-09 18:51:15 +02:00
|
|
|
__throw_exception_again;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
template <typename _Tp, typename _Alloc>
|
|
|
|
void
|
|
|
|
deque<_Tp,_Alloc>::
|
|
|
|
_M_new_elements_at_back(size_type __new_elems)
|
|
|
|
{
|
|
|
|
size_type __new_nodes
|
|
|
|
= (__new_elems + _S_buffer_size() - 1) / _S_buffer_size();
|
|
|
|
_M_reserve_map_at_back(__new_nodes);
|
|
|
|
size_type __i;
|
|
|
|
try
|
|
|
|
{
|
|
|
|
for (__i = 1; __i <= __new_nodes; ++__i)
|
2003-01-16 21:30:50 +01:00
|
|
|
*(this->_M_finish._M_node + __i) = _M_allocate_node();
|
deque.tcc, [...]: Re-indent contents of namespace std, re-wrap comment lines as necessary.
2002-08-09 Phil Edwards <pme@gcc.gnu.org>
* include/bits/deque.tcc, include/bits/list.tcc,
include/bits/stl_deque.h, include/bits/stl_iterator_base_funcs.h,
include/bits/stl_list.h, include/bits/stl_map.h,
include/bits/stl_multimap.h, include/bits/stl_queue.h,
include/bits/stl_stack.h, include/bits/stl_vector.h,
include/bits/vector.tcc: Re-indent contents of namespace std,
re-wrap comment lines as necessary.
From-SVN: r56165
2002-08-09 18:51:15 +02:00
|
|
|
}
|
|
|
|
catch(...)
|
|
|
|
{
|
|
|
|
for (size_type __j = 1; __j < __i; ++__j)
|
2003-01-16 21:30:50 +01:00
|
|
|
_M_deallocate_node(*(this->_M_finish._M_node + __j));
|
deque.tcc, [...]: Re-indent contents of namespace std, re-wrap comment lines as necessary.
2002-08-09 Phil Edwards <pme@gcc.gnu.org>
* include/bits/deque.tcc, include/bits/list.tcc,
include/bits/stl_deque.h, include/bits/stl_iterator_base_funcs.h,
include/bits/stl_list.h, include/bits/stl_map.h,
include/bits/stl_multimap.h, include/bits/stl_queue.h,
include/bits/stl_stack.h, include/bits/stl_vector.h,
include/bits/vector.tcc: Re-indent contents of namespace std,
re-wrap comment lines as necessary.
From-SVN: r56165
2002-08-09 18:51:15 +02:00
|
|
|
__throw_exception_again;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
template <typename _Tp, typename _Alloc>
|
|
|
|
void
|
|
|
|
deque<_Tp,_Alloc>::
|
|
|
|
_M_reallocate_map(size_type __nodes_to_add, bool __add_at_front)
|
|
|
|
{
|
2003-01-16 21:30:50 +01:00
|
|
|
size_type __old_num_nodes
|
|
|
|
= this->_M_finish._M_node - this->_M_start._M_node + 1;
|
deque.tcc, [...]: Re-indent contents of namespace std, re-wrap comment lines as necessary.
2002-08-09 Phil Edwards <pme@gcc.gnu.org>
* include/bits/deque.tcc, include/bits/list.tcc,
include/bits/stl_deque.h, include/bits/stl_iterator_base_funcs.h,
include/bits/stl_list.h, include/bits/stl_map.h,
include/bits/stl_multimap.h, include/bits/stl_queue.h,
include/bits/stl_stack.h, include/bits/stl_vector.h,
include/bits/vector.tcc: Re-indent contents of namespace std,
re-wrap comment lines as necessary.
From-SVN: r56165
2002-08-09 18:51:15 +02:00
|
|
|
size_type __new_num_nodes = __old_num_nodes + __nodes_to_add;
|
|
|
|
|
|
|
|
_Map_pointer __new_nstart;
|
2003-01-16 21:30:50 +01:00
|
|
|
if (this->_M_map_size > 2 * __new_num_nodes)
|
2002-06-13 00:07:53 +02:00
|
|
|
{
|
2003-01-16 21:30:50 +01:00
|
|
|
__new_nstart
|
|
|
|
= this->_M_map + (this->_M_map_size - __new_num_nodes) / 2
|
|
|
|
+ (__add_at_front ? __nodes_to_add : 0);
|
|
|
|
if (__new_nstart < this->_M_start._M_node)
|
2003-07-04 22:41:28 +02:00
|
|
|
std::copy(this->_M_start._M_node,
|
|
|
|
this->_M_finish._M_node + 1,
|
|
|
|
__new_nstart);
|
deque.tcc, [...]: Re-indent contents of namespace std, re-wrap comment lines as necessary.
2002-08-09 Phil Edwards <pme@gcc.gnu.org>
* include/bits/deque.tcc, include/bits/list.tcc,
include/bits/stl_deque.h, include/bits/stl_iterator_base_funcs.h,
include/bits/stl_list.h, include/bits/stl_map.h,
include/bits/stl_multimap.h, include/bits/stl_queue.h,
include/bits/stl_stack.h, include/bits/stl_vector.h,
include/bits/vector.tcc: Re-indent contents of namespace std,
re-wrap comment lines as necessary.
From-SVN: r56165
2002-08-09 18:51:15 +02:00
|
|
|
else
|
2003-07-04 22:41:28 +02:00
|
|
|
std::copy_backward(this->_M_start._M_node,
|
|
|
|
this->_M_finish._M_node + 1,
|
|
|
|
__new_nstart + __old_num_nodes);
|
2002-06-13 00:07:53 +02:00
|
|
|
}
|
deque.tcc, [...]: Re-indent contents of namespace std, re-wrap comment lines as necessary.
2002-08-09 Phil Edwards <pme@gcc.gnu.org>
* include/bits/deque.tcc, include/bits/list.tcc,
include/bits/stl_deque.h, include/bits/stl_iterator_base_funcs.h,
include/bits/stl_list.h, include/bits/stl_map.h,
include/bits/stl_multimap.h, include/bits/stl_queue.h,
include/bits/stl_stack.h, include/bits/stl_vector.h,
include/bits/vector.tcc: Re-indent contents of namespace std,
re-wrap comment lines as necessary.
From-SVN: r56165
2002-08-09 18:51:15 +02:00
|
|
|
else
|
2002-06-13 00:07:53 +02:00
|
|
|
{
|
deque.tcc, [...]: Re-indent contents of namespace std, re-wrap comment lines as necessary.
2002-08-09 Phil Edwards <pme@gcc.gnu.org>
* include/bits/deque.tcc, include/bits/list.tcc,
include/bits/stl_deque.h, include/bits/stl_iterator_base_funcs.h,
include/bits/stl_list.h, include/bits/stl_map.h,
include/bits/stl_multimap.h, include/bits/stl_queue.h,
include/bits/stl_stack.h, include/bits/stl_vector.h,
include/bits/vector.tcc: Re-indent contents of namespace std,
re-wrap comment lines as necessary.
From-SVN: r56165
2002-08-09 18:51:15 +02:00
|
|
|
size_type __new_map_size =
|
2003-01-16 21:30:50 +01:00
|
|
|
this->_M_map_size + std::max(this->_M_map_size, __nodes_to_add) + 2;
|
deque.tcc, [...]: Re-indent contents of namespace std, re-wrap comment lines as necessary.
2002-08-09 Phil Edwards <pme@gcc.gnu.org>
* include/bits/deque.tcc, include/bits/list.tcc,
include/bits/stl_deque.h, include/bits/stl_iterator_base_funcs.h,
include/bits/stl_list.h, include/bits/stl_map.h,
include/bits/stl_multimap.h, include/bits/stl_queue.h,
include/bits/stl_stack.h, include/bits/stl_vector.h,
include/bits/vector.tcc: Re-indent contents of namespace std,
re-wrap comment lines as necessary.
From-SVN: r56165
2002-08-09 18:51:15 +02:00
|
|
|
|
|
|
|
_Map_pointer __new_map = _M_allocate_map(__new_map_size);
|
|
|
|
__new_nstart = __new_map + (__new_map_size - __new_num_nodes) / 2
|
|
|
|
+ (__add_at_front ? __nodes_to_add : 0);
|
2003-07-04 22:41:28 +02:00
|
|
|
std::copy(this->_M_start._M_node,
|
|
|
|
this->_M_finish._M_node + 1,
|
|
|
|
__new_nstart);
|
2003-01-16 21:30:50 +01:00
|
|
|
_M_deallocate_map(this->_M_map, this->_M_map_size);
|
deque.tcc, [...]: Re-indent contents of namespace std, re-wrap comment lines as necessary.
2002-08-09 Phil Edwards <pme@gcc.gnu.org>
* include/bits/deque.tcc, include/bits/list.tcc,
include/bits/stl_deque.h, include/bits/stl_iterator_base_funcs.h,
include/bits/stl_list.h, include/bits/stl_map.h,
include/bits/stl_multimap.h, include/bits/stl_queue.h,
include/bits/stl_stack.h, include/bits/stl_vector.h,
include/bits/vector.tcc: Re-indent contents of namespace std,
re-wrap comment lines as necessary.
From-SVN: r56165
2002-08-09 18:51:15 +02:00
|
|
|
|
2003-01-16 21:30:50 +01:00
|
|
|
this->_M_map = __new_map;
|
|
|
|
this->_M_map_size = __new_map_size;
|
deque.tcc, [...]: Re-indent contents of namespace std, re-wrap comment lines as necessary.
2002-08-09 Phil Edwards <pme@gcc.gnu.org>
* include/bits/deque.tcc, include/bits/list.tcc,
include/bits/stl_deque.h, include/bits/stl_iterator_base_funcs.h,
include/bits/stl_list.h, include/bits/stl_map.h,
include/bits/stl_multimap.h, include/bits/stl_queue.h,
include/bits/stl_stack.h, include/bits/stl_vector.h,
include/bits/vector.tcc: Re-indent contents of namespace std,
re-wrap comment lines as necessary.
From-SVN: r56165
2002-08-09 18:51:15 +02:00
|
|
|
}
|
|
|
|
|
2003-01-16 21:30:50 +01:00
|
|
|
this->_M_start._M_set_node(__new_nstart);
|
|
|
|
this->_M_finish._M_set_node(__new_nstart + __old_num_nodes - 1);
|
2002-06-13 00:07:53 +02:00
|
|
|
}
|
|
|
|
} // namespace std
|
|
|
|
|
2003-07-05 06:05:45 +02:00
|
|
|
#endif
|