aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaolo Carlini <pcarlini@suse.de>2007-03-31 19:48:41 +0000
committerPaolo Carlini <paolo@gcc.gnu.org>2007-03-31 19:48:41 +0000
commit232c49252634e798efd4e9e84c2c9e4013e10f1e (patch)
treea2309621c4cef9d90f3dc324e097a39c0333e20f
parent29e86cb09c6ffe497456341864551b504c9a6f4f (diff)
downloadgcc-232c49252634e798efd4e9e84c2c9e4013e10f1e.zip
gcc-232c49252634e798efd4e9e84c2c9e4013e10f1e.tar.gz
gcc-232c49252634e798efd4e9e84c2c9e4013e10f1e.tar.bz2
stl_bvector.h (_M_fill_insert(iterator, size_type, bool), [...]): Move out of line...
2007-03-31 Paolo Carlini <pcarlini@suse.de> * include/bits/stl_bvector.h (_M_fill_insert(iterator, size_type, bool), _M_insert_range(iterator, _ForwardIterator, _ForwardIterator, std::forward_iterator_tag), _M_insert_aux(iterator, bool)): Move out of line... * include/bits/vector.tcc: ... here. From-SVN: r123389
-rw-r--r--libstdc++-v3/ChangeLog8
-rw-r--r--libstdc++-v3/include/bits/stl_bvector.h115
-rw-r--r--libstdc++-v3/include/bits/vector.tcc127
3 files changed, 140 insertions, 110 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index a6ab09b..d05f5b5 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,11 @@
+2007-03-31 Paolo Carlini <pcarlini@suse.de>
+
+ * include/bits/stl_bvector.h (_M_fill_insert(iterator, size_type,
+ bool), _M_insert_range(iterator, _ForwardIterator, _ForwardIterator,
+ std::forward_iterator_tag), _M_insert_aux(iterator, bool)): Move
+ out of line...
+ * include/bits/vector.tcc: ... here.
+
2007-03-30 Paolo Carlini <pcarlini@suse.de>
PR c++/26099
diff --git a/libstdc++-v3/include/bits/stl_bvector.h b/libstdc++-v3/include/bits/stl_bvector.h
index de72dac..6f24154 100644
--- a/libstdc++-v3/include/bits/stl_bvector.h
+++ b/libstdc++-v3/include/bits/stl_bvector.h
@@ -373,7 +373,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD)
__fill_bvector(__first, __last, __x);
}
- template<class _Alloc>
+ template<typename _Alloc>
struct _Bvector_base
{
typedef typename _Alloc::template rebind<_Bit_type>::other
@@ -501,7 +501,7 @@ template<typename _Alloc>
_M_copy_aligned(__x.begin(), __x.end(), this->_M_impl._M_start);
}
- template<class _InputIterator>
+ template<typename _InputIterator>
vector(_InputIterator __first, _InputIterator __last,
const allocator_type& __a = allocator_type())
: _Base(__a)
@@ -535,7 +535,7 @@ template<typename _Alloc>
assign(size_type __n, const bool& __x)
{ _M_fill_assign(__n, __x); }
- template<class _InputIterator>
+ template<typename _InputIterator>
void
assign(_InputIterator __first, _InputIterator __last)
{
@@ -712,7 +712,7 @@ template<typename _Alloc>
return begin() + __n;
}
- template<class _InputIterator>
+ template<typename _InputIterator>
void
insert(iterator __position,
_InputIterator __first, _InputIterator __last)
@@ -790,7 +790,7 @@ template<typename _Alloc>
}
// Check whether it's an integral type. If so, it's not an iterator.
- template<class _Integer>
+ template<typename _Integer>
void
_M_initialize_dispatch(_Integer __n, _Integer __x, __true_type)
{
@@ -799,14 +799,14 @@ template<typename _Alloc>
this->_M_impl._M_end_of_storage, __x ? ~0 : 0);
}
- template<class _InputIterator>
+ template<typename _InputIterator>
void
_M_initialize_dispatch(_InputIterator __first, _InputIterator __last,
__false_type)
{ _M_initialize_range(__first, __last,
std::__iterator_category(__first)); }
- template<class _InputIterator>
+ template<typename _InputIterator>
void
_M_initialize_range(_InputIterator __first, _InputIterator __last,
std::input_iterator_tag)
@@ -815,7 +815,7 @@ template<typename _Alloc>
push_back(*__first);
}
- template<class _ForwardIterator>
+ template<typename _ForwardIterator>
void
_M_initialize_range(_ForwardIterator __first, _ForwardIterator __last,
std::forward_iterator_tag)
@@ -825,7 +825,7 @@ template<typename _Alloc>
std::copy(__first, __last, this->_M_impl._M_start);
}
- template<class _Integer>
+ template<typename _Integer>
void
_M_assign_dispatch(_Integer __n, _Integer __val, __true_type)
{ _M_fill_assign((size_t) __n, (bool) __val); }
@@ -853,7 +853,7 @@ template<typename _Alloc>
}
}
- template<class _InputIterator>
+ template<typename _InputIterator>
void
_M_assign_aux(_InputIterator __first, _InputIterator __last,
std::input_iterator_tag)
@@ -867,7 +867,7 @@ template<typename _Alloc>
insert(end(), __first, __last);
}
- template<class _ForwardIterator>
+ template<typename _ForwardIterator>
void
_M_assign_aux(_ForwardIterator __first, _ForwardIterator __last,
std::forward_iterator_tag)
@@ -885,13 +885,13 @@ template<typename _Alloc>
}
// Check whether it's an integral type. If so, it's not an iterator.
- template<class _Integer>
+ template<typename _Integer>
void
_M_insert_dispatch(iterator __pos, _Integer __n, _Integer __x,
__true_type)
{ _M_fill_insert(__pos, __n, __x); }
- template<class _InputIterator>
+ template<typename _InputIterator>
void
_M_insert_dispatch(iterator __pos,
_InputIterator __first, _InputIterator __last,
@@ -900,35 +900,9 @@ template<typename _Alloc>
std::__iterator_category(__first)); }
void
- _M_fill_insert(iterator __position, size_type __n, bool __x)
- {
- if (__n == 0)
- return;
- if (capacity() - size() >= __n)
- {
- std::copy_backward(__position, end(),
- this->_M_impl._M_finish + difference_type(__n));
- std::fill(__position, __position + difference_type(__n), __x);
- this->_M_impl._M_finish += difference_type(__n);
- }
- else
- {
- const size_type __len = size() + std::max(size(), __n);
- _Bit_type * __q = this->_M_allocate(__len);
- iterator __i = _M_copy_aligned(begin(), __position,
- iterator(__q, 0));
- std::fill(__i, __i + difference_type(__n), __x);
- this->_M_impl._M_finish = std::copy(__position, end(),
- __i + difference_type(__n));
- this->_M_deallocate();
- this->_M_impl._M_end_of_storage = (__q + ((__len
- + int(_S_word_bit) - 1)
- / int(_S_word_bit)));
- this->_M_impl._M_start = iterator(__q, 0);
- }
- }
+ _M_fill_insert(iterator __position, size_type __n, bool __x);
- template<class _InputIterator>
+ template<typename _InputIterator>
void
_M_insert_range(iterator __pos, _InputIterator __first,
_InputIterator __last, std::input_iterator_tag)
@@ -940,66 +914,13 @@ template<typename _Alloc>
}
}
- template<class _ForwardIterator>
+ template<typename _ForwardIterator>
void
_M_insert_range(iterator __position, _ForwardIterator __first,
- _ForwardIterator __last, std::forward_iterator_tag)
- {
- if (__first != __last)
- {
- size_type __n = std::distance(__first, __last);
- if (capacity() - size() >= __n)
- {
- std::copy_backward(__position, end(),
- this->_M_impl._M_finish
- + difference_type(__n));
- std::copy(__first, __last, __position);
- this->_M_impl._M_finish += difference_type(__n);
- }
- else
- {
- const size_type __len = size() + std::max(size(), __n);
- _Bit_type * __q = this->_M_allocate(__len);
- iterator __i = _M_copy_aligned(begin(), __position,
- iterator(__q, 0));
- __i = std::copy(__first, __last, __i);
- this->_M_impl._M_finish = std::copy(__position, end(), __i);
- this->_M_deallocate();
- this->_M_impl._M_end_of_storage = (__q
- + ((__len
- + int(_S_word_bit) - 1)
- / int(_S_word_bit)));
- this->_M_impl._M_start = iterator(__q, 0);
- }
- }
- }
+ _ForwardIterator __last, std::forward_iterator_tag);
void
- _M_insert_aux(iterator __position, bool __x)
- {
- if (this->_M_impl._M_finish._M_p != this->_M_impl._M_end_of_storage)
- {
- std::copy_backward(__position, this->_M_impl._M_finish,
- this->_M_impl._M_finish + 1);
- *__position = __x;
- ++this->_M_impl._M_finish;
- }
- else
- {
- const size_type __len = size() ? 2 * size()
- : static_cast<size_type>(_S_word_bit);
- _Bit_type * __q = this->_M_allocate(__len);
- iterator __i = _M_copy_aligned(begin(), __position,
- iterator(__q, 0));
- *__i++ = __x;
- this->_M_impl._M_finish = std::copy(__position, end(), __i);
- this->_M_deallocate();
- this->_M_impl._M_end_of_storage = (__q + ((__len
- + int(_S_word_bit) - 1)
- / int(_S_word_bit)));
- this->_M_impl._M_start = iterator(__q, 0);
- }
- }
+ _M_insert_aux(iterator __position, bool __x);
void
_M_erase_at_end(iterator __pos)
diff --git a/libstdc++-v3/include/bits/vector.tcc b/libstdc++-v3/include/bits/vector.tcc
index f476c46..9b416be 100644
--- a/libstdc++-v3/include/bits/vector.tcc
+++ b/libstdc++-v3/include/bits/vector.tcc
@@ -1,6 +1,7 @@
// Vector implementation (out of line) -*- C++ -*-
-// Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007
+// Free Software Foundation, Inc.
//
// 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
@@ -388,18 +389,19 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD)
}
}
- template<typename _Tp, typename _Alloc> template<typename _InputIterator>
- void
- vector<_Tp, _Alloc>::
- _M_range_insert(iterator __pos, _InputIterator __first,
- _InputIterator __last, std::input_iterator_tag)
- {
- for (; __first != __last; ++__first)
- {
- __pos = insert(__pos, *__first);
- ++__pos;
- }
- }
+ template<typename _Tp, typename _Alloc>
+ template<typename _InputIterator>
+ void
+ vector<_Tp, _Alloc>::
+ _M_range_insert(iterator __pos, _InputIterator __first,
+ _InputIterator __last, std::input_iterator_tag)
+ {
+ for (; __first != __last; ++__first)
+ {
+ __pos = insert(__pos, *__first);
+ ++__pos;
+ }
+ }
template<typename _Tp, typename _Alloc>
template<typename _ForwardIterator>
@@ -491,6 +493,105 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD)
}
}
+
+ // vector<bool>
+
+ template<typename _Alloc>
+ void
+ vector<bool, _Alloc>::
+ _M_fill_insert(iterator __position, size_type __n, bool __x)
+ {
+ if (__n == 0)
+ return;
+ if (capacity() - size() >= __n)
+ {
+ std::copy_backward(__position, end(),
+ this->_M_impl._M_finish + difference_type(__n));
+ std::fill(__position, __position + difference_type(__n), __x);
+ this->_M_impl._M_finish += difference_type(__n);
+ }
+ else
+ {
+ const size_type __len = size() + std::max(size(), __n);
+ _Bit_type * __q = this->_M_allocate(__len);
+ iterator __i = _M_copy_aligned(begin(), __position,
+ iterator(__q, 0));
+ std::fill(__i, __i + difference_type(__n), __x);
+ this->_M_impl._M_finish = std::copy(__position, end(),
+ __i + difference_type(__n));
+ this->_M_deallocate();
+ this->_M_impl._M_end_of_storage = (__q + ((__len
+ + int(_S_word_bit) - 1)
+ / int(_S_word_bit)));
+ this->_M_impl._M_start = iterator(__q, 0);
+ }
+ }
+
+ template<typename _Alloc>
+ template<typename _ForwardIterator>
+ void
+ vector<bool, _Alloc>::
+ _M_insert_range(iterator __position, _ForwardIterator __first,
+ _ForwardIterator __last, std::forward_iterator_tag)
+ {
+ if (__first != __last)
+ {
+ size_type __n = std::distance(__first, __last);
+ if (capacity() - size() >= __n)
+ {
+ std::copy_backward(__position, end(),
+ this->_M_impl._M_finish
+ + difference_type(__n));
+ std::copy(__first, __last, __position);
+ this->_M_impl._M_finish += difference_type(__n);
+ }
+ else
+ {
+ const size_type __len = size() + std::max(size(), __n);
+ _Bit_type * __q = this->_M_allocate(__len);
+ iterator __i = _M_copy_aligned(begin(), __position,
+ iterator(__q, 0));
+ __i = std::copy(__first, __last, __i);
+ this->_M_impl._M_finish = std::copy(__position, end(), __i);
+ this->_M_deallocate();
+ this->_M_impl._M_end_of_storage = (__q
+ + ((__len
+ + int(_S_word_bit) - 1)
+ / int(_S_word_bit)));
+ this->_M_impl._M_start = iterator(__q, 0);
+ }
+ }
+ }
+
+ template<typename _Alloc>
+ void
+ vector<bool, _Alloc>::
+ _M_insert_aux(iterator __position, bool __x)
+ {
+ if (this->_M_impl._M_finish._M_p != this->_M_impl._M_end_of_storage)
+ {
+ std::copy_backward(__position, this->_M_impl._M_finish,
+ this->_M_impl._M_finish + 1);
+ *__position = __x;
+ ++this->_M_impl._M_finish;
+ }
+ else
+ {
+ const size_type __len = size() ? 2 * size()
+ : static_cast<size_type>(_S_word_bit);
+ _Bit_type * __q = this->_M_allocate(__len);
+ iterator __i = _M_copy_aligned(begin(), __position,
+ iterator(__q, 0));
+ *__i++ = __x;
+ this->_M_impl._M_finish = std::copy(__position, end(), __i);
+ this->_M_deallocate();
+ this->_M_impl._M_end_of_storage = (__q + ((__len
+ + int(_S_word_bit) - 1)
+ / int(_S_word_bit)));
+ this->_M_impl._M_start = iterator(__q, 0);
+ }
+ }
+
_GLIBCXX_END_NESTED_NAMESPACE
#endif /* _VECTOR_TCC */