From 62c7a041bba8823e25dff3108de78f4053ec0a36 Mon Sep 17 00:00:00 2001 From: Paolo Carlini Date: Wed, 9 Aug 2006 09:56:15 +0000 Subject: stl_algobase.h (fill(const _Deque_iterator<>&, const _Deque_iterator<>&, const _Tp&)): Move... 2006-08-09 Paolo Carlini * include/bits/stl_algobase.h (fill(const _Deque_iterator<>&, const _Deque_iterator<>&, const _Tp&)): Move... * include/bits/deque.tcc: ... here. * include/bits/stl_deque.h: Declare. From-SVN: r116034 --- libstdc++-v3/ChangeLog | 7 +++++++ libstdc++-v3/include/bits/deque.tcc | 22 ++++++++++++++++++++++ libstdc++-v3/include/bits/stl_algobase.h | 26 -------------------------- libstdc++-v3/include/bits/stl_deque.h | 5 +++++ 4 files changed, 34 insertions(+), 26 deletions(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 7983c7e..efb06c9 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,10 @@ +2006-08-09 Paolo Carlini + + * include/bits/stl_algobase.h (fill(const _Deque_iterator<>&, + const _Deque_iterator<>&, const _Tp&)): Move... + * include/bits/deque.tcc: ... here. + * include/bits/stl_deque.h: Declare. + 2006-08-06 Paolo Carlini PR libstdc++/16611 diff --git a/libstdc++-v3/include/bits/deque.tcc b/libstdc++-v3/include/bits/deque.tcc index 294a0dd..8740101 100644 --- a/libstdc++-v3/include/bits/deque.tcc +++ b/libstdc++-v3/include/bits/deque.tcc @@ -744,6 +744,28 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD) this->_M_impl._M_finish._M_set_node(__new_nstart + __old_num_nodes - 1); } + // Overload for deque::iterators, exploiting the "segmented-iterator + // optimization". NB: leave const_iterators alone! + template + void + fill(const _Deque_iterator<_Tp, _Tp&, _Tp*>& __first, + const _Deque_iterator<_Tp, _Tp&, _Tp*>& __last, const _Tp& __value) + { + typedef typename _Deque_iterator<_Tp, _Tp&, _Tp*>::_Self _Self; + + for (typename _Self::_Map_pointer __node = __first._M_node + 1; + __node < __last._M_node; ++__node) + std::fill(*__node, *__node + _Self::_S_buffer_size(), __value); + + if (__first._M_node != __last._M_node) + { + std::fill(__first._M_cur, __first._M_last, __value); + std::fill(__last._M_first, __last._M_cur, __value); + } + else + std::fill(__first._M_cur, __last._M_cur, __value); + } + _GLIBCXX_END_NESTED_NAMESPACE #endif diff --git a/libstdc++-v3/include/bits/stl_algobase.h b/libstdc++-v3/include/bits/stl_algobase.h index da93e15..9507241 100644 --- a/libstdc++-v3/include/bits/stl_algobase.h +++ b/libstdc++-v3/include/bits/stl_algobase.h @@ -618,32 +618,6 @@ _GLIBCXX_BEGIN_NAMESPACE(std) std::memset(__first, static_cast(__tmp), __last - __first); } - template - struct _Deque_iterator; - - // Overload for deque::iterators, exploiting the "segmented-iterator - // optimization". NB: leave const_iterators alone! - template - void - fill(const _Deque_iterator<_Tp, _Tp&, _Tp*>& __first, - const _Deque_iterator<_Tp, _Tp&, _Tp*>& __last, const _Tp& __value) - { - typedef typename _Deque_iterator<_Tp, _Tp&, _Tp*>::_Self _Self; - - for (typename _Self::_Map_pointer __node = __first._M_node + 1; - __node < __last._M_node; ++__node) - std::fill(*__node, *__node + _Self::_S_buffer_size(), __value); - - if (__first._M_node != __last._M_node) - { - std::fill(__first._M_cur, __first._M_last, __value); - std::fill(__last._M_first, __last._M_cur, __value); - } - else - std::fill(__first._M_cur, __last._M_cur, __value); - } - - template struct __fill_n { diff --git a/libstdc++-v3/include/bits/stl_deque.h b/libstdc++-v3/include/bits/stl_deque.h index 8f3fc99..ffa5874 100644 --- a/libstdc++-v3/include/bits/stl_deque.h +++ b/libstdc++-v3/include/bits/stl_deque.h @@ -350,6 +350,11 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD) operator+(ptrdiff_t __n, const _Deque_iterator<_Tp, _Ref, _Ptr>& __x) { return __x + __n; } + template + void + fill(const _Deque_iterator<_Tp, _Tp&, _Tp*>& __first, + const _Deque_iterator<_Tp, _Tp&, _Tp*>& __last, const _Tp& __value); + /** * @if maint * Deque base class. This class provides the unified face for %deque's -- cgit v1.1