summaryrefslogtreecommitdiff
path: root/libstdc++-v3/include
diff options
context:
space:
mode:
authorpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>2005-12-24 10:01:45 +0000
committerpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>2005-12-24 10:01:45 +0000
commit7edc3ee63d3f8eff18e58ce885f8e18a82ea1512 (patch)
treee44e8954f064d44f3469757c00c73bc1132796a6 /libstdc++-v3/include
parent0f3d70f0f21c1a67189e5fc7cedea638c36f1f62 (diff)
downloadgcc-7edc3ee63d3f8eff18e58ce885f8e18a82ea1512.tar.gz
2005-12-24 Paolo Carlini <pcarlini@suse.de>
* include/bits/stl_algobase.h (fill(const _Deque_iterator&, const _Deque_iterator&, const _Tp&)): Deal, correctly, only with iterators (leave const_iterators alone). 2005-12-24 Paolo Carlini <pcarlini@suse.de> * include/bits/stl_algobase.h (fill(const _Deque_iterator<>&, const _Deque_iterator<>&, const _Tp&)): Add. * testsuite/23_containers/deque/cons/assign/1.cc: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@109038 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3/include')
-rw-r--r--libstdc++-v3/include/bits/stl_algobase.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/libstdc++-v3/include/bits/stl_algobase.h b/libstdc++-v3/include/bits/stl_algobase.h
index 730699648e1..9a2e7af16c4 100644
--- a/libstdc++-v3/include/bits/stl_algobase.h
+++ b/libstdc++-v3/include/bits/stl_algobase.h
@@ -594,6 +594,32 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
std::memset(__first, static_cast<unsigned char>(__tmp), __last - __first);
}
+ template<typename _Tp, typename _Ref, typename _Ptr>
+ struct _Deque_iterator;
+
+ // Overload for deque::iterators, exploiting the "segmented-iterator
+ // optimization". NB: leave const_iterators alone!
+ template<typename _Tp>
+ 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<bool>
struct __fill_n
{