From 75bef4340507e9c9defcfdb6c3cfd916a4a64786 Mon Sep 17 00:00:00 2001 From: Benjamin Kosnik Date: Tue, 26 Jun 2001 23:12:45 +0000 Subject: [PATCH] stream_iterator.h (istream_iterator): Add copy ctor. 2001-06-26 Benjamin Kosnik * include/bits/stream_iterator.h (istream_iterator): Add copy ctor. (ostream_iterator): Same. * include/bits/stl_iterator.h (front_insert_iterator::operator=): Change argument to const_reference. (back_insert_iterator): Same. From-SVN: r43596 --- libstdc++-v3/ChangeLog | 8 ++++++++ libstdc++-v3/include/bits/stl_iterator.h | 4 ++-- libstdc++-v3/include/bits/stream_iterator.h | 18 ++++++++++++++---- 3 files changed, 24 insertions(+), 6 deletions(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index ead8ee3fcf4..18b3b5d22d0 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,11 @@ +2001-06-26 Benjamin Kosnik + + * include/bits/stream_iterator.h (istream_iterator): Add copy ctor. + (ostream_iterator): Same. + * include/bits/stl_iterator.h (front_insert_iterator::operator=): + Change argument to const_reference. + (back_insert_iterator): Same. + 2001-06-26 Benjamin Kosnik * include/bits/sbuf_iter.h: Change to.. diff --git a/libstdc++-v3/include/bits/stl_iterator.h b/libstdc++-v3/include/bits/stl_iterator.h index eb136326302..eb638923b03 100644 --- a/libstdc++-v3/include/bits/stl_iterator.h +++ b/libstdc++-v3/include/bits/stl_iterator.h @@ -196,7 +196,7 @@ namespace std back_insert_iterator(_Container& __x) : container(&__x) {} back_insert_iterator& - operator=(const typename _Container::value_type& __value) + operator=(const typename _Container::const_reference __value) { container->push_back(__value); return *this; @@ -230,7 +230,7 @@ namespace std explicit front_insert_iterator(_Container& __x) : container(&__x) {} front_insert_iterator& - operator=(const typename _Container::value_type& __value) + operator=(const typename _Container::const_reference __value) { container->push_front(__value); return *this; diff --git a/libstdc++-v3/include/bits/stream_iterator.h b/libstdc++-v3/include/bits/stream_iterator.h index 0ee8e384d57..c6bde4edf17 100644 --- a/libstdc++-v3/include/bits/stream_iterator.h +++ b/libstdc++-v3/include/bits/stream_iterator.h @@ -51,8 +51,14 @@ namespace std public: istream_iterator() : _M_stream(0), _M_ok(false) {} + istream_iterator(istream_type& __s) : _M_stream(&__s) { _M_read(); } + istream_iterator(const istream_iterator& __obj) + : _M_stream(__obj._M_stream), _M_value(__obj._M_value), + _M_ok(__obj._M_ok) + { } + const _Tp& operator*() const { return _M_value; } @@ -96,9 +102,9 @@ namespace std template inline bool - operator!=(const istream_iterator<_Tp, _CharT, _Traits, _Dist>& __x, - const istream_iterator<_Tp, _CharT, _Traits, _Dist>& __y) - { return !__x._M_equal(__y); } + operator!=(const istream_iterator<_Tp, _CharT, _Traits, _Dist>& __x, + const istream_iterator<_Tp, _CharT, _Traits, _Dist>& __y) + { return !__x._M_equal(__y); } template