stream_iterator.h (istream_iterator): Add copy ctor.

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.

From-SVN: r43596
This commit is contained in:
Benjamin Kosnik 2001-06-26 23:12:45 +00:00 committed by Benjamin Kosnik
parent 767094ddfd
commit 75bef43405
3 changed files with 24 additions and 6 deletions

View File

@ -1,3 +1,11 @@
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.
2001-06-26 Benjamin Kosnik <bkoz@redhat.com> 2001-06-26 Benjamin Kosnik <bkoz@redhat.com>
* include/bits/sbuf_iter.h: Change to.. * include/bits/sbuf_iter.h: Change to..

View File

@ -196,7 +196,7 @@ namespace std
back_insert_iterator(_Container& __x) : container(&__x) {} back_insert_iterator(_Container& __x) : container(&__x) {}
back_insert_iterator& back_insert_iterator&
operator=(const typename _Container::value_type& __value) operator=(const typename _Container::const_reference __value)
{ {
container->push_back(__value); container->push_back(__value);
return *this; return *this;
@ -230,7 +230,7 @@ namespace std
explicit front_insert_iterator(_Container& __x) : container(&__x) {} explicit front_insert_iterator(_Container& __x) : container(&__x) {}
front_insert_iterator& front_insert_iterator&
operator=(const typename _Container::value_type& __value) operator=(const typename _Container::const_reference __value)
{ {
container->push_front(__value); container->push_front(__value);
return *this; return *this;

View File

@ -51,8 +51,14 @@ namespace std
public: public:
istream_iterator() : _M_stream(0), _M_ok(false) {} istream_iterator() : _M_stream(0), _M_ok(false) {}
istream_iterator(istream_type& __s) : _M_stream(&__s) { _M_read(); } 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& const _Tp&
operator*() const { return _M_value; } operator*() const { return _M_value; }
@ -96,9 +102,9 @@ namespace std
template <class _Tp, class _CharT, class _Traits, class _Dist> template <class _Tp, class _CharT, class _Traits, class _Dist>
inline bool inline bool
operator!=(const istream_iterator<_Tp, _CharT, _Traits, _Dist>& __x, operator!=(const istream_iterator<_Tp, _CharT, _Traits, _Dist>& __x,
const istream_iterator<_Tp, _CharT, _Traits, _Dist>& __y) const istream_iterator<_Tp, _CharT, _Traits, _Dist>& __y)
{ return !__x._M_equal(__y); } { return !__x._M_equal(__y); }
template<typename _Tp, typename _CharT = char, template<typename _Tp, typename _CharT = char,
@ -117,8 +123,12 @@ namespace std
public: public:
ostream_iterator(ostream_type& __s) : _M_stream(&__s), _M_string(0) {} ostream_iterator(ostream_type& __s) : _M_stream(&__s), _M_string(0) {}
ostream_iterator(ostream_type& __s, const _CharT* __c) 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& ostream_iterator&
operator=(const _Tp& __value) operator=(const _Tp& __value)