diff options
author | bkoz <bkoz@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-06-26 23:12:45 +0000 |
---|---|---|
committer | bkoz <bkoz@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-06-26 23:12:45 +0000 |
commit | b128dd1973ab7f63cfacd78bda023c584ae05078 (patch) | |
tree | 4ca678fe72ffbc2c8e248801fa419b687b5fd2d7 /libstdc++-v3/include/bits | |
parent | 71d6ad5e02ce6813862ecfb4f24170154e619590 (diff) | |
download | gcc-b128dd1973ab7f63cfacd78bda023c584ae05078.tar.gz |
2001-06-26 Benjamin Kosnik <bkoz@redhat.com>
* 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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@43596 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3/include/bits')
-rw-r--r-- | libstdc++-v3/include/bits/stl_iterator.h | 4 | ||||
-rw-r--r-- | libstdc++-v3/include/bits/stream_iterator.h | 18 |
2 files changed, 16 insertions, 6 deletions
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 <class _Tp, class _CharT, class _Traits, class _Dist> 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<typename _Tp, typename _CharT = char, @@ -117,8 +123,12 @@ namespace std public: ostream_iterator(ostream_type& __s) : _M_stream(&__s), _M_string(0) {} + ostream_iterator(ostream_type& __s, const _CharT* __c) - : _M_stream(&__s), _M_string(__c) { } + : _M_stream(&__s), _M_string(__c) { } + + ostream_iterator(const ostream_iterator& __obj) + : _M_stream(__obj._M_stream), _M_string(__obj._M_string) { } ostream_iterator& operator=(const _Tp& __value) |