30#ifndef _STREAM_ITERATOR_H
31#define _STREAM_ITERATOR_H 1
33#pragma GCC system_header
37namespace std _GLIBCXX_VISIBILITY(default)
39_GLIBCXX_BEGIN_NAMESPACE_VERSION
47 template<
typename _Tp,
typename _CharT = char,
48 typename _Traits = char_traits<_CharT>,
typename _Dist = ptrdiff_t>
50 :
public iterator<input_iterator_tag, _Tp, _Dist, const _Tp*, const _Tp&>
53 typedef _CharT char_type;
54 typedef _Traits traits_type;
68 : _M_stream(0), _M_value(), _M_ok(false) {}
76 : _M_stream(__obj._M_stream), _M_value(__obj._M_value),
80#if __cplusplus > 201703L && __cpp_lib_concepts
83 noexcept(is_nothrow_default_constructible_v<_Tp>)
87#if __cplusplus >= 201103L
89 ~istream_iterator() =
default;
95 __glibcxx_requires_cond(_M_ok,
96 _M_message(__gnu_debug::__msg_deref_istream)
107 __glibcxx_requires_cond(_M_ok,
108 _M_message(__gnu_debug::__msg_inc_istream)
109 ._M_iterator(*
this));
117 __glibcxx_requires_cond(_M_ok,
118 _M_message(__gnu_debug::__msg_inc_istream)
119 ._M_iterator(*
this));
131 return (_M_ok == __x._M_ok) && (!_M_ok || _M_stream == __x._M_stream);
137 if (_M_stream && !(*_M_stream >> _M_value))
148 {
return __x._M_equal(__y); }
154 {
return !__x._M_equal(__y); }
156#if __cplusplus > 201703L && __cpp_lib_concepts
159 {
return !__i._M_stream; }
174 template<
typename _Tp,
typename _CharT = char,
175 typename _Traits = char_traits<_CharT> >
177 :
public iterator<output_iterator_tag, void, void, void, void>
182#if __cplusplus > 201703L
192 const _CharT* _M_string;
195#if __cplusplus > 201703L
197 : _M_stream(
nullptr), _M_string(
nullptr) { }
219 : _M_stream(__obj._M_stream), _M_string(__obj._M_string) { }
221#if __cplusplus >= 201103L
230 __glibcxx_requires_cond(_M_stream != 0,
231 _M_message(__gnu_debug::__msg_output_ostream)
232 ._M_iterator(*
this));
233 *_M_stream << __value;
235 *_M_stream << _M_string;
254_GLIBCXX_END_NAMESPACE_VERSION
constexpr _Tp * __addressof(_Tp &__r) noexcept
Same as C++11 std::addressof.
ISO C++ entities toplevel namespace is std.
Template class basic_istream.
Template class basic_ostream.
void difference_type
Distance between iterators is represented as this type.
Provides input iterator semantics for streams.
friend bool operator!=(const istream_iterator &__x, const istream_iterator &__y)
Return true if the iterators refer to different streams, or if one is at end-of-stream and the other ...
istream_iterator(istream_type &__s)
Construct start of input stream iterator.
constexpr istream_iterator()
Construct end of input stream iterator.
friend bool operator==(const istream_iterator &__x, const istream_iterator &__y)
Return true if the iterators refer to the same stream, or are both at end-of-stream.
Provides output iterator semantics for streams.
_CharT char_type
Public typedef.
ostream_iterator(ostream_type &__s)
Construct from an ostream.
_Traits traits_type
Public typedef.
ostream_iterator(const ostream_iterator &__obj)
Copy constructor.
ostream_iterator & operator=(const _Tp &__value)
Writes value to underlying ostream using operator<<. If constructed with delimiter string,...
basic_ostream< _CharT, _Traits > ostream_type
Public typedef.
ostream_iterator(ostream_type &__s, const _CharT *__c)