32#ifndef _RWSTD_RW_IOITER_H_INCLUDED
33#define _RWSTD_RW_IOITER_H_INCLUDED
35#ifndef _RWSTD_RW_IOSFWD_H_INCLUDED
39#ifndef _RWSTD_RW_ITERBASE_H_INCLUDED
47#ifndef _RWSTD_IOSFWD_INCLUDED
49template <
class _CharT,
class _Traits =
char_traits<_CharT> >
50struct istreambuf_iterator;
52template <
class _CharT,
class _Traits =
char_traits<_CharT> >
53struct ostreambuf_iterator;
59template <
class _CharT,
class _Traits>
60struct istreambuf_iterator
61 : iterator<input_iterator_tag, _CharT,
62 typename _Traits::off_type, _CharT*, _CharT&>
64 typedef _CharT char_type;
65 typedef _Traits traits_type;
66 typedef typename traits_type::int_type int_type;
67 typedef basic_streambuf<char_type, traits_type> streambuf_type;
68 typedef basic_istream<char_type, traits_type> istream_type;
75 streambuf_type *_C_sb;
77 _C_proxy (char_type __c, streambuf_type *__sb)
78 : _C_keep (__c), _C_sb (__sb) { }
86 friend struct istreambuf_iterator<char_type, traits_type>;
91#ifndef _RWSTD_STRICT_ANSI
94 typedef _C_proxy proxy;
99 istreambuf_iterator (streambuf_type *__sb = 0)
_THROWS (())
103 istreambuf_iterator (istream_type&)
_THROWS (());
106 istreambuf_iterator (
const _C_proxy &__proxy)
_THROWS (())
107 : _C_sb (__proxy._C_sb) { }
113 istreambuf_iterator& operator++ ();
116 _C_proxy operator++ (
int);
119 bool equal (
const istreambuf_iterator&)
const;
122 streambuf_type *_C_sb;
128template <
class _CharT,
class _Traits>
129inline istreambuf_iterator<_CharT, _Traits>::
130istreambuf_iterator (istream_type &__strm)
_THROWS (())
131 : _C_sb (__strm.rdbuf ())
137template <
class _CharT,
class _Traits>
138inline typename istreambuf_iterator<_CharT, _Traits>::char_type
139istreambuf_iterator<_CharT, _Traits>::
145 return traits_type::to_char_type (_C_sb->sgetc ());
149template <
class _CharT,
class _Traits>
150inline istreambuf_iterator<_CharT, _Traits>&
151istreambuf_iterator<_CharT, _Traits>::
163template <
class _CharT,
class _Traits>
164inline typename istreambuf_iterator<_CharT, _Traits>::_C_proxy
165istreambuf_iterator<_CharT, _Traits>::
171 return _C_proxy (traits_type::to_char_type (_C_sb->sbumpc ()), _C_sb);
175template <
class _CharT,
class _Traits>
177istreambuf_iterator<_CharT, _Traits>::
178equal (
const istreambuf_iterator &__rhs)
const
185 const int_type __eof = traits_type::eof ();
187 const bool __eof_lhs =
188 !_C_sb || traits_type::eq_int_type (_C_sb->sgetc (), __eof);
190 const bool __eof_rhs =
191 !__rhs._C_sb || traits_type::eq_int_type (__rhs._C_sb->sgetc(), __eof);
193 return __eof_lhs == __eof_rhs;
198template <
class _CharT,
class _Traits>
200operator== (
const istreambuf_iterator<_CharT, _Traits>& __x,
201 const istreambuf_iterator<_CharT, _Traits>& __y)
203 return __x.equal (__y);
208template <
class _CharT,
class _Traits>
210operator!= (
const istreambuf_iterator<_CharT, _Traits>& __x,
211 const istreambuf_iterator<_CharT, _Traits>& __y)
213 return !__x.equal (__y);
218template <
class _CharT,
class _Traits>
219struct ostreambuf_iterator
220 :
public iterator<output_iterator_tag, void, void, void, void>
222 typedef _CharT char_type;
223 typedef _Traits traits_type;
224 typedef basic_streambuf<char_type, traits_type> streambuf_type;
225 typedef basic_ostream<char_type, traits_type> ostream_type;
228 ostreambuf_iterator (ostream_type&)
_THROWS (());
231 ostreambuf_iterator (streambuf_type *__sb)
_THROWS (())
242 ostreambuf_iterator& operator++ () {
247 ostreambuf_iterator& operator++ (
int) {
252 ostreambuf_iterator& operator= (char_type __c) {
253 if (_C_sb && traits_type::eq_int_type (_C_sb->sputc (__c),
254 traits_type::eof ()))
260 bool failed ()
const _THROWS (()) {
265 streambuf_type *_C_sb;
271template <
class _CharT,
class _Traits>
272inline ostreambuf_iterator<_CharT, _Traits>::
273ostreambuf_iterator (ostream_type &__strm)
_THROWS (())
274 : _C_sb (__strm.rdbuf ())
bool equal(const T &x, const U &y)
const plus_asgn< T > & operator*(const plus_asgn< T > &lhs, const plus_asgn< T > &rhs)
#define _RWSTD_NAMESPACE(name)
#define _RWSTD_ASSERT(ignore)
bool operator==(const json_pointer< RefStringTypeLhs > &lhs, const json_pointer< RefStringTypeRhs > &rhs) noexcept
bool operator!=(const json_pointer< RefStringTypeLhs > &lhs, const json_pointer< RefStringTypeRhs > &rhs) noexcept