mirror of git://gcc.gnu.org/git/gcc.git
2016-06-15 François Dumont <fdumont@gcc.gnu.org>
* include/bits/stl_deque.h (std::deque<>::operator=): Call _M_assign_aux. (std::deque<>::assign(initializer_list<>)): Likewise. (std::deque<>::resize(size_t, const value_type&)): Call _M_fill_insert. (std::deque<>::insert(const_iterator, initializer_list<>)): Call _M_range_insert_aux. (std::deque<>::_M_assign_aux<It>(It, It, std::forward_iterator_tag): Likewise. (std::deque<>::_M_fill_assign): Call _M_fill_insert. (std::deque<>::_M_move_assign2): Call _M_assign_aux. * include/bits/deque.tcc (std::deque<>::operator=): Call _M_range_insert_aux. (std::deque<>::_M_assign_aux<It>(It, It, std::input_iterator_tag)): Likewise. * include/bits/stl_vector.h (std::vector<>::operator=): Call _M_assign_aux. (std::vector<>::assign(initializer_list<>)): Likewise. (std::vector<>::resize(size_t, const value_type&)): Call _M_fill_insert. (std::vector<>::insert(const_iterator, initializer_list<>)): Call _M_range_insert. * include/bits/vector.tcc (std::vector<>::_M_assign_aux): Likewise. From-SVN: r237495
This commit is contained in:
parent
1a3c3ee9bc
commit
d7e16fc536
|
|
@ -1,3 +1,27 @@
|
|||
2016-06-15 François Dumont <fdumont@gcc.gnu.org>
|
||||
|
||||
* include/bits/stl_deque.h
|
||||
(std::deque<>::operator=): Call _M_assign_aux.
|
||||
(std::deque<>::assign(initializer_list<>)): Likewise.
|
||||
(std::deque<>::resize(size_t, const value_type&)): Call _M_fill_insert.
|
||||
(std::deque<>::insert(const_iterator, initializer_list<>)):
|
||||
Call _M_range_insert_aux.
|
||||
(std::deque<>::_M_assign_aux<It>(It, It, std::forward_iterator_tag):
|
||||
Likewise.
|
||||
(std::deque<>::_M_fill_assign): Call _M_fill_insert.
|
||||
(std::deque<>::_M_move_assign2): Call _M_assign_aux.
|
||||
* include/bits/deque.tcc
|
||||
(std::deque<>::operator=): Call _M_range_insert_aux.
|
||||
(std::deque<>::_M_assign_aux<It>(It, It, std::input_iterator_tag)):
|
||||
Likewise.
|
||||
* include/bits/stl_vector.h
|
||||
(std::vector<>::operator=): Call _M_assign_aux.
|
||||
(std::vector<>::assign(initializer_list<>)): Likewise.
|
||||
(std::vector<>::resize(size_t, const value_type&)): Call _M_fill_insert.
|
||||
(std::vector<>::insert(const_iterator, initializer_list<>)):
|
||||
Call _M_range_insert.
|
||||
* include/bits/vector.tcc (std::vector<>::_M_assign_aux): Likewise.
|
||||
|
||||
2016-06-07 François Dumont <fdumont@gcc.gnu.org>
|
||||
|
||||
* include/std/tuple (_Head_base<>): Default specialization condition at
|
||||
|
|
|
|||
|
|
@ -119,7 +119,8 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
|
|||
{
|
||||
const_iterator __mid = __x.begin() + difference_type(__len);
|
||||
std::copy(__x.begin(), __mid, this->_M_impl._M_start);
|
||||
insert(this->_M_impl._M_finish, __mid, __x.end());
|
||||
_M_range_insert_aux(this->_M_impl._M_finish, __mid, __x.end(),
|
||||
std::random_access_iterator_tag());
|
||||
}
|
||||
}
|
||||
return *this;
|
||||
|
|
@ -280,7 +281,8 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
|
|||
if (__first == __last)
|
||||
_M_erase_at_end(__cur);
|
||||
else
|
||||
insert(end(), __first, __last);
|
||||
_M_range_insert_aux(end(), __first, __last,
|
||||
std::__iterator_category(__first));
|
||||
}
|
||||
|
||||
template <typename _Tp, typename _Alloc>
|
||||
|
|
|
|||
|
|
@ -1081,7 +1081,8 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
|
|||
deque&
|
||||
operator=(initializer_list<value_type> __l)
|
||||
{
|
||||
this->assign(__l.begin(), __l.end());
|
||||
_M_assign_aux(__l.begin(), __l.end(),
|
||||
random_access_iterator_tag());
|
||||
return *this;
|
||||
}
|
||||
#endif
|
||||
|
|
@ -1142,7 +1143,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
|
|||
*/
|
||||
void
|
||||
assign(initializer_list<value_type> __l)
|
||||
{ this->assign(__l.begin(), __l.end()); }
|
||||
{ _M_assign_aux(__l.begin(), __l.end(), random_access_iterator_tag()); }
|
||||
#endif
|
||||
|
||||
/// Get a copy of the memory allocation object.
|
||||
|
|
@ -1306,7 +1307,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
|
|||
{
|
||||
const size_type __len = size();
|
||||
if (__new_size > __len)
|
||||
insert(this->_M_impl._M_finish, __new_size - __len, __x);
|
||||
_M_fill_insert(this->_M_impl._M_finish, __new_size - __len, __x);
|
||||
else if (__new_size < __len)
|
||||
_M_erase_at_end(this->_M_impl._M_start
|
||||
+ difference_type(__new_size));
|
||||
|
|
@ -1328,7 +1329,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
|
|||
{
|
||||
const size_type __len = size();
|
||||
if (__new_size > __len)
|
||||
insert(this->_M_impl._M_finish, __new_size - __len, __x);
|
||||
_M_fill_insert(this->_M_impl._M_finish, __new_size - __len, __x);
|
||||
else if (__new_size < __len)
|
||||
_M_erase_at_end(this->_M_impl._M_start
|
||||
+ difference_type(__new_size));
|
||||
|
|
@ -1645,7 +1646,12 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
|
|||
*/
|
||||
iterator
|
||||
insert(const_iterator __p, initializer_list<value_type> __l)
|
||||
{ return this->insert(__p, __l.begin(), __l.end()); }
|
||||
{
|
||||
auto __offset = __p - cbegin();
|
||||
_M_range_insert_aux(__p._M_const_cast(), __l.begin(), __l.end(),
|
||||
std::random_access_iterator_tag());
|
||||
return begin() + __offset;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
|
|
@ -1819,9 +1825,8 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
|
|||
_M_initialize_dispatch(_InputIterator __first, _InputIterator __last,
|
||||
__false_type)
|
||||
{
|
||||
typedef typename std::iterator_traits<_InputIterator>::
|
||||
iterator_category _IterCategory;
|
||||
_M_range_initialize(__first, __last, _IterCategory());
|
||||
_M_range_initialize(__first, __last,
|
||||
std::__iterator_category(__first));
|
||||
}
|
||||
|
||||
// called by the second initialize_dispatch above
|
||||
|
|
@ -1884,11 +1889,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
|
|||
void
|
||||
_M_assign_dispatch(_InputIterator __first, _InputIterator __last,
|
||||
__false_type)
|
||||
{
|
||||
typedef typename std::iterator_traits<_InputIterator>::
|
||||
iterator_category _IterCategory;
|
||||
_M_assign_aux(__first, __last, _IterCategory());
|
||||
}
|
||||
{ _M_assign_aux(__first, __last, std::__iterator_category(__first)); }
|
||||
|
||||
// called by the second assign_dispatch above
|
||||
template<typename _InputIterator>
|
||||
|
|
@ -1908,7 +1909,8 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
|
|||
_ForwardIterator __mid = __first;
|
||||
std::advance(__mid, size());
|
||||
std::copy(__first, __mid, begin());
|
||||
insert(end(), __mid, __last);
|
||||
_M_range_insert_aux(end(), __mid, __last,
|
||||
std::__iterator_category(__first));
|
||||
}
|
||||
else
|
||||
_M_erase_at_end(std::copy(__first, __last, begin()));
|
||||
|
|
@ -1922,7 +1924,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
|
|||
if (__n > size())
|
||||
{
|
||||
std::fill(begin(), end(), __val);
|
||||
insert(end(), __n - size(), __val);
|
||||
_M_fill_insert(end(), __n - size(), __val);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -1970,9 +1972,8 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
|
|||
_InputIterator __first, _InputIterator __last,
|
||||
__false_type)
|
||||
{
|
||||
typedef typename std::iterator_traits<_InputIterator>::
|
||||
iterator_category _IterCategory;
|
||||
_M_range_insert_aux(__pos, __first, __last, _IterCategory());
|
||||
_M_range_insert_aux(__pos, __first, __last,
|
||||
std::__iterator_category(__first));
|
||||
}
|
||||
|
||||
// called by the second insert_dispatch above
|
||||
|
|
@ -2196,8 +2197,9 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
|
|||
{
|
||||
// The rvalue's allocator cannot be moved and is not equal,
|
||||
// so we need to individually move each element.
|
||||
this->assign(std::__make_move_if_noexcept_iterator(__x.begin()),
|
||||
std::__make_move_if_noexcept_iterator(__x.end()));
|
||||
_M_assign_aux(std::__make_move_if_noexcept_iterator(__x.begin()),
|
||||
std::__make_move_if_noexcept_iterator(__x.end()),
|
||||
std::random_access_iterator_tag());
|
||||
__x.clear();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -320,7 +320,8 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
|
|||
vector(const vector& __x)
|
||||
: _Base(__x.size(),
|
||||
_Alloc_traits::_S_select_on_copy(__x._M_get_Tp_allocator()))
|
||||
{ this->_M_impl._M_finish =
|
||||
{
|
||||
this->_M_impl._M_finish =
|
||||
std::__uninitialized_copy_a(__x.begin(), __x.end(),
|
||||
this->_M_impl._M_start,
|
||||
_M_get_Tp_allocator());
|
||||
|
|
@ -340,7 +341,8 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
|
|||
/// Copy constructor with alternative allocator
|
||||
vector(const vector& __x, const allocator_type& __a)
|
||||
: _Base(__x.size(), __a)
|
||||
{ this->_M_impl._M_finish =
|
||||
{
|
||||
this->_M_impl._M_finish =
|
||||
std::__uninitialized_copy_a(__x.begin(), __x.end(),
|
||||
this->_M_impl._M_start,
|
||||
_M_get_Tp_allocator());
|
||||
|
|
@ -470,7 +472,8 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
|
|||
vector&
|
||||
operator=(initializer_list<value_type> __l)
|
||||
{
|
||||
this->assign(__l.begin(), __l.end());
|
||||
this->_M_assign_aux(__l.begin(), __l.end(),
|
||||
random_access_iterator_tag());
|
||||
return *this;
|
||||
}
|
||||
#endif
|
||||
|
|
@ -532,7 +535,10 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
|
|||
*/
|
||||
void
|
||||
assign(initializer_list<value_type> __l)
|
||||
{ this->assign(__l.begin(), __l.end()); }
|
||||
{
|
||||
this->_M_assign_aux(__l.begin(), __l.end(),
|
||||
random_access_iterator_tag());
|
||||
}
|
||||
#endif
|
||||
|
||||
/// Get a copy of the memory allocation object.
|
||||
|
|
@ -694,7 +700,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
|
|||
resize(size_type __new_size, const value_type& __x)
|
||||
{
|
||||
if (__new_size > size())
|
||||
insert(end(), __new_size - size(), __x);
|
||||
_M_fill_insert(end(), __new_size - size(), __x);
|
||||
else if (__new_size < size())
|
||||
_M_erase_at_end(this->_M_impl._M_start + __new_size);
|
||||
}
|
||||
|
|
@ -714,7 +720,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
|
|||
resize(size_type __new_size, value_type __x = value_type())
|
||||
{
|
||||
if (__new_size > size())
|
||||
insert(end(), __new_size - size(), __x);
|
||||
_M_fill_insert(end(), __new_size - size(), __x);
|
||||
else if (__new_size < size())
|
||||
_M_erase_at_end(this->_M_impl._M_start + __new_size);
|
||||
}
|
||||
|
|
@ -1030,7 +1036,12 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
|
|||
*/
|
||||
iterator
|
||||
insert(const_iterator __position, initializer_list<value_type> __l)
|
||||
{ return this->insert(__position, __l.begin(), __l.end()); }
|
||||
{
|
||||
auto __offset = __position - cbegin();
|
||||
_M_range_insert(begin() + __offset, __l.begin(), __l.end(),
|
||||
std::random_access_iterator_tag());
|
||||
return begin() + __offset;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
|
|
@ -1328,11 +1339,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
|
|||
void
|
||||
_M_assign_dispatch(_InputIterator __first, _InputIterator __last,
|
||||
__false_type)
|
||||
{
|
||||
typedef typename std::iterator_traits<_InputIterator>::
|
||||
iterator_category _IterCategory;
|
||||
_M_assign_aux(__first, __last, _IterCategory());
|
||||
}
|
||||
{ _M_assign_aux(__first, __last, std::__iterator_category(__first)); }
|
||||
|
||||
// Called by the second assign_dispatch above
|
||||
template<typename _InputIterator>
|
||||
|
|
@ -1351,7 +1358,6 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
|
|||
void
|
||||
_M_fill_assign(size_type __n, const value_type& __val);
|
||||
|
||||
|
||||
// Internal insert functions follow.
|
||||
|
||||
// Called by the range insert to implement [23.1.1]/9
|
||||
|
|
@ -1370,9 +1376,8 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
|
|||
_M_insert_dispatch(iterator __pos, _InputIterator __first,
|
||||
_InputIterator __last, __false_type)
|
||||
{
|
||||
typedef typename std::iterator_traits<_InputIterator>::
|
||||
iterator_category _IterCategory;
|
||||
_M_range_insert(__pos, __first, __last, _IterCategory());
|
||||
_M_range_insert(__pos, __first, __last,
|
||||
std::__iterator_category(__first));
|
||||
}
|
||||
|
||||
// Called by the second insert_dispatch above
|
||||
|
|
|
|||
|
|
@ -256,7 +256,8 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
|
|||
if (__first == __last)
|
||||
_M_erase_at_end(__cur);
|
||||
else
|
||||
insert(end(), __first, __last);
|
||||
_M_range_insert(end(), __first, __last,
|
||||
std::__iterator_category(__first));
|
||||
}
|
||||
|
||||
template<typename _Tp, typename _Alloc>
|
||||
|
|
|
|||
Loading…
Reference in New Issue