Commit da73f9de by Paolo Carlini Committed by Paolo Carlini

stl_bvector.h: Fully qualify standard functions with std::, thus avoiding Koenig lookup.

2003-07-02  Paolo Carlini  <pcarlini@unitus.it>

	* include/bits/stl_bvector.h: Fully qualify standard
	functions with std::, thus avoiding Koenig lookup.
	* include/bits/stl_construct.h: Likewise.
	* include/bits/stl_deque.h: Likewise.

From-SVN: r68828
parent 1c380095
2003-07-02 Paolo Carlini <pcarlini@unitus.it>
* include/bits/stl_bvector.h: Fully qualify standard
functions with std::, thus avoiding Koenig lookup.
* include/bits/stl_construct.h: Likewise.
* include/bits/stl_deque.h: Likewise.
2003-07-02 Paolo Carlini <pcarlini@unitus.it>
* testsuite/22_locale/num_put/put/char/7.cc: Include
<testsuite_hooks.h>, tweak.
* testsuite/22_locale/num_put/put/wchar_t/7.cc: Likewise.
......
......@@ -380,7 +380,7 @@ template <typename _Alloc>
}
void _M_insert_aux(iterator __position, bool __x) {
if (this->_M_finish._M_p != this->_M_end_of_storage) {
copy_backward(__position, this->_M_finish, this->_M_finish + 1);
std::copy_backward(__position, this->_M_finish, this->_M_finish + 1);
*__position = __x;
++this->_M_finish;
}
......@@ -388,9 +388,9 @@ template <typename _Alloc>
size_type __len = size()
? 2 * size() : static_cast<size_type>(_S_word_bit);
_Bit_type * __q = _M_bit_alloc(__len);
iterator __i = copy(begin(), __position, iterator(__q, 0));
iterator __i = std::copy(begin(), __position, iterator(__q, 0));
*__i++ = __x;
this->_M_finish = copy(__position, end(), __i);
this->_M_finish = std::copy(__position, end(), __i);
_M_deallocate();
this->_M_end_of_storage = __q + (__len + _S_word_bit - 1)/_S_word_bit;
this->_M_start = iterator(__q, 0);
......@@ -412,7 +412,7 @@ template <typename _Alloc>
forward_iterator_tag) {
size_type __n = std::distance(__first, __last);
_M_initialize(__n);
copy(__first, __last, this->_M_start);
std::copy(__first, __last, this->_M_start);
}
template <class _InputIterator>
......@@ -432,17 +432,17 @@ template <typename _Alloc>
if (__first != __last) {
size_type __n = std::distance(__first, __last);
if (capacity() - size() >= __n) {
copy_backward(__position, end(),
this->_M_finish + difference_type(__n));
copy(__first, __last, __position);
std::copy_backward(__position, end(),
this->_M_finish + difference_type(__n));
std::copy(__first, __last, __position);
this->_M_finish += difference_type(__n);
}
else {
size_type __len = size() + std::max(size(), __n);
_Bit_type * __q = _M_bit_alloc(__len);
iterator __i = copy(begin(), __position, iterator(__q, 0));
__i = copy(__first, __last, __i);
this->_M_finish = copy(__position, end(), __i);
iterator __i = std::copy(begin(), __position, iterator(__q, 0));
__i = std::copy(__first, __last, __i);
this->_M_finish = std::copy(__position, end(), __i);
_M_deallocate();
this->_M_end_of_storage
= __q + (__len + _S_word_bit - 1)/_S_word_bit;
......@@ -496,19 +496,19 @@ template <typename _Alloc>
: _Bvector_base<_Alloc>(__a)
{
_M_initialize(__n);
fill(this->_M_start._M_p, this->_M_end_of_storage, __value ? ~0 : 0);
std::fill(this->_M_start._M_p, this->_M_end_of_storage, __value ? ~0 : 0);
}
explicit vector(size_type __n)
: _Bvector_base<_Alloc>(allocator_type())
{
_M_initialize(__n);
fill(this->_M_start._M_p, this->_M_end_of_storage, 0);
std::fill(this->_M_start._M_p, this->_M_end_of_storage, 0);
}
vector(const vector& __x) : _Bvector_base<_Alloc>(__x.get_allocator()) {
_M_initialize(__x.size());
copy(__x.begin(), __x.end(), this->_M_start);
std::copy(__x.begin(), __x.end(), this->_M_start);
}
// Check whether it's an integral type. If so, it's not an iterator.
......@@ -516,7 +516,7 @@ template <typename _Alloc>
template <class _Integer>
void _M_initialize_dispatch(_Integer __n, _Integer __x, __true_type) {
_M_initialize(__n);
fill(this->_M_start._M_p, this->_M_end_of_storage, __x ? ~0 : 0);
std::fill(this->_M_start._M_p, this->_M_end_of_storage, __x ? ~0 : 0);
}
template <class _InputIterator>
......@@ -542,7 +542,7 @@ template <typename _Alloc>
_M_deallocate();
_M_initialize(__x.size());
}
copy(__x.begin(), __x.end(), begin());
std::copy(__x.begin(), __x.end(), begin());
this->_M_finish = begin() + difference_type(__x.size());
return *this;
}
......@@ -554,12 +554,12 @@ template <typename _Alloc>
void _M_fill_assign(size_t __n, bool __x) {
if (__n > size()) {
fill(this->_M_start._M_p, this->_M_end_of_storage, __x ? ~0 : 0);
std::fill(this->_M_start._M_p, this->_M_end_of_storage, __x ? ~0 : 0);
insert(end(), __n - size(), __x);
}
else {
erase(begin() + __n, end());
fill(this->_M_start._M_p, this->_M_end_of_storage, __x ? ~0 : 0);
std::fill(this->_M_start._M_p, this->_M_end_of_storage, __x ? ~0 : 0);
}
}
......@@ -596,11 +596,11 @@ template <typename _Alloc>
forward_iterator_tag) {
size_type __len = std::distance(__first, __last);
if (__len < size())
erase(copy(__first, __last, begin()), end());
erase(std::copy(__first, __last, begin()), end());
else {
_ForwardIterator __mid = __first;
advance(__mid, size());
copy(__first, __mid, begin());
std::advance(__mid, size());
std::copy(__first, __mid, begin());
insert(end(), __mid, __last);
}
}
......@@ -610,7 +610,7 @@ template <typename _Alloc>
__throw_length_error(__N("vector::reserve"));
if (this->capacity() < __n) {
_Bit_type * __q = _M_bit_alloc(__n);
this->_M_finish = copy(begin(), end(), iterator(__q, 0));
this->_M_finish = std::copy(begin(), end(), iterator(__q, 0));
_M_deallocate();
this->_M_start = iterator(__q, 0);
this->_M_end_of_storage = __q + (__n + _S_word_bit - 1)/_S_word_bit;
......@@ -675,17 +675,17 @@ template <typename _Alloc>
void _M_fill_insert(iterator __position, size_type __n, bool __x) {
if (__n == 0) return;
if (capacity() - size() >= __n) {
copy_backward(__position, end(),
this->_M_finish + difference_type(__n));
fill(__position, __position + difference_type(__n), __x);
std::copy_backward(__position, end(),
this->_M_finish + difference_type(__n));
std::fill(__position, __position + difference_type(__n), __x);
this->_M_finish += difference_type(__n);
}
else {
size_type __len = size() + std::max(size(), __n);
_Bit_type * __q = _M_bit_alloc(__len);
iterator __i = copy(begin(), __position, iterator(__q, 0));
fill_n(__i, __n, __x);
this->_M_finish = copy(__position, end(), __i + difference_type(__n));
iterator __i = std::copy(begin(), __position, iterator(__q, 0));
std::fill_n(__i, __n, __x);
this->_M_finish = std::copy(__position, end(), __i + difference_type(__n));
_M_deallocate();
this->_M_end_of_storage = __q + (__len + _S_word_bit - 1)/_S_word_bit;
this->_M_start = iterator(__q, 0);
......@@ -699,12 +699,12 @@ template <typename _Alloc>
void pop_back() { --this->_M_finish; }
iterator erase(iterator __position) {
if (__position + 1 != end())
copy(__position + 1, end(), __position);
std::copy(__position + 1, end(), __position);
--this->_M_finish;
return __position;
}
iterator erase(iterator __first, iterator __last) {
this->_M_finish = copy(__last, end(), __first);
this->_M_finish = std::copy(__last, end(), __first);
return __first;
}
void resize(size_type __new_size, bool __x = bool()) {
......
......@@ -90,6 +90,16 @@ namespace std
/**
* @if maint
* Destroy the object pointed to by a pointer type.
* @endif
*/
template <class _Tp>
inline void
_Destroy(_Tp* __pointer)
{ __pointer->~_Tp(); }
/**
* @if maint
* Destroy a range of objects with nontrivial destructors.
*
* This is a helper function used only by _Destroy().
......@@ -98,7 +108,7 @@ namespace std
template <class _ForwardIterator>
inline void
__destroy_aux(_ForwardIterator __first, _ForwardIterator __last, __false_type)
{ for ( ; __first != __last; ++__first) _Destroy(&*__first); }
{ for ( ; __first != __last; ++__first) std::_Destroy(&*__first); }
/**
* @if maint
......@@ -116,16 +126,6 @@ namespace std
/**
* @if maint
* Destroy the object pointed to by a pointer type.
* @endif
*/
template <class _Tp>
inline void
_Destroy(_Tp* __pointer)
{ __pointer->~_Tp(); }
/**
* @if maint
* Destroy a range of objects. If the value_type of the object has
* a trivial destructor, the compiler should optimize all of this
* away, otherwise the objects' destructors must be invoked.
......@@ -140,7 +140,7 @@ namespace std
typedef typename __type_traits<_Value_type>::has_trivial_destructor
_Has_trivial_destructor;
__destroy_aux(__first, __last, _Has_trivial_destructor());
std::__destroy_aux(__first, __last, _Has_trivial_destructor());
}
} // namespace std
......
......@@ -723,7 +723,7 @@ namespace std
*/
deque(const deque& __x)
: _Base(__x.get_allocator(), __x.size())
{ uninitialized_copy(__x.begin(), __x.end(), this->_M_start); }
{ std::uninitialized_copy(__x.begin(), __x.end(), this->_M_start); }
/**
* @brief Builds a %deque from a range.
......@@ -753,7 +753,7 @@ namespace std
* themselves are pointers, the pointed-to memory is not touched in any
* way. Managing the pointer is the user's responsibilty.
*/
~deque() { _Destroy(this->_M_start, this->_M_finish); }
~deque() { std::_Destroy(this->_M_start, this->_M_finish); }
/**
* @brief %Deque assignment operator.
......@@ -1021,7 +1021,7 @@ namespace std
push_front(const value_type& __x)
{
if (this->_M_start._M_cur != this->_M_start._M_first) {
_Construct(this->_M_start._M_cur - 1, __x);
std::_Construct(this->_M_start._M_cur - 1, __x);
--this->_M_start._M_cur;
}
else
......@@ -1040,7 +1040,7 @@ namespace std
push_back(const value_type& __x)
{
if (this->_M_finish._M_cur != this->_M_finish._M_last - 1) {
_Construct(this->_M_finish._M_cur, __x);
std::_Construct(this->_M_finish._M_cur, __x);
++this->_M_finish._M_cur;
}
else
......@@ -1059,7 +1059,7 @@ namespace std
pop_front()
{
if (this->_M_start._M_cur != this->_M_start._M_last - 1) {
_Destroy(this->_M_start._M_cur);
std::_Destroy(this->_M_start._M_cur);
++this->_M_start._M_cur;
}
else
......@@ -1079,7 +1079,7 @@ namespace std
{
if (this->_M_finish._M_cur != this->_M_finish._M_first) {
--this->_M_finish._M_cur;
_Destroy(this->_M_finish._M_cur);
std::_Destroy(this->_M_finish._M_cur);
}
else
_M_pop_back_aux();
......@@ -1292,12 +1292,12 @@ namespace std
size_type __len = std::distance(__first, __last);
if (__len > size()) {
_ForwardIterator __mid = __first;
advance(__mid, size());
copy(__first, __mid, begin());
std::advance(__mid, size());
std::copy(__first, __mid, begin());
insert(end(), __mid, __last);
}
else
erase(copy(__first, __last, begin()), end());
erase(std::copy(__first, __last, begin()), end());
}
// Called by assign(n,t), and the range assign when it turns out to be the
......@@ -1307,13 +1307,13 @@ namespace std
{
if (__n > size())
{
fill(begin(), end(), __val);
std::fill(begin(), end(), __val);
insert(end(), __n - size(), __val);
}
else
{
erase(begin() + __n, end());
fill(begin(), end(), __val);
std::fill(begin(), end(), __val);
}
}
......@@ -1469,7 +1469,7 @@ namespace std
const deque<_Tp, _Alloc>& __y)
{
return __x.size() == __y.size() &&
equal(__x.begin(), __x.end(), __y.begin());
std::equal(__x.begin(), __x.end(), __y.begin());
}
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment