30 #ifndef _STREAM_ITERATOR_H 31 #define _STREAM_ITERATOR_H 1 33 #pragma GCC system_header 37 namespace std _GLIBCXX_VISIBILITY(default)
39 _GLIBCXX_BEGIN_NAMESPACE_VERSION
47 #pragma GCC diagnostic push 48 #pragma GCC diagnostic ignored "-Wdeprecated-declarations" 51 template<
typename _Tp,
typename _CharT = char,
52 typename _Traits = char_traits<_CharT>,
typename _Dist = ptrdiff_t>
54 :
public iterator<input_iterator_tag, _Tp, _Dist, const _Tp*, const _Tp&>
57 typedef _CharT char_type;
58 typedef _Traits traits_type;
73 : _M_stream(0), _M_value(), _M_ok(false) {}
82 : _M_stream(__obj._M_stream), _M_value(__obj._M_value),
86 #if __cplusplus > 201703L && __cpp_lib_concepts 89 noexcept(is_nothrow_default_constructible_v<_Tp>)
93 #if __cplusplus >= 201103L 100 operator*() const _GLIBCXX_NOEXCEPT
102 __glibcxx_requires_cond(_M_ok,
103 _M_message(__gnu_debug::__msg_deref_istream)
104 ._M_iterator(*
this));
110 operator->() const _GLIBCXX_NOEXCEPT
116 __glibcxx_requires_cond(_M_ok,
117 _M_message(__gnu_debug::__msg_inc_istream)
118 ._M_iterator(*
this));
126 __glibcxx_requires_cond(_M_ok,
127 _M_message(__gnu_debug::__msg_inc_istream)
128 ._M_iterator(*
this));
140 return (_M_ok == __x._M_ok) && (!_M_ok || _M_stream == __x._M_stream);
146 if (_M_stream && !(*_M_stream >> _M_value))
159 {
return __x._M_equal(__y); }
161 #if __cpp_impl_three_way_comparison < 201907L 168 {
return !__x._M_equal(__y); }
171 #if __cplusplus > 201703L && __cpp_lib_concepts 175 {
return !__i._M_stream; }
190 template<
typename _Tp,
typename _CharT = char,
191 typename _Traits = char_traits<_CharT> >
193 :
public iterator<output_iterator_tag, void, void, void, void>
198 #if __cplusplus > 201703L 208 const _CharT* _M_string;
230 : _M_stream(__obj._M_stream), _M_string(__obj._M_string) { }
232 #if __cplusplus >= 201103L 241 __glibcxx_requires_cond(_M_stream != 0,
242 _M_message(__gnu_debug::__msg_output_ostream)
243 ._M_iterator(*
this));
244 *_M_stream << __value;
246 *_M_stream << _M_string;
252 operator*() _GLIBCXX_NOEXCEPT
256 operator++() _GLIBCXX_NOEXCEPT
260 operator++(
int) _GLIBCXX_NOEXCEPT
263 #pragma GCC diagnostic pop 267 _GLIBCXX_END_NAMESPACE_VERSION
ostream_iterator(ostream_type &__s) noexcept
Construct from an ostream.
ostream_iterator(const ostream_iterator &__obj) noexcept
Copy constructor.
Provides output iterator semantics for streams.
constexpr istream_iterator() noexcept(/*conditional */)
Construct end of input stream iterator.
is_nothrow_copy_constructible
friend bool operator==(const istream_iterator &__x, const istream_iterator &__y) noexcept
Return true if the iterators refer to the same stream, or are both at end-of-stream.
Template class basic_istream.
ostream_iterator(ostream_type &__s, const _CharT *__c) noexcept
Provides input iterator semantics for streams.
ISO C++ entities toplevel namespace is std.
ptrdiff_t difference_type
Public typedef.
is_nothrow_default_constructible
ostream_iterator & operator=(const _Tp &__value)
Writes value to underlying ostream using operator<<. If constructed with delimiter string...
Template class basic_ostream.
istream_iterator(istream_type &__s)
Construct start of input stream iterator.
constexpr _Tp * __addressof(_Tp &__r) noexcept
Same as C++11 std::addressof.
_CharT char_type
Public typedef.
_Traits traits_type
Public typedef.
basic_ostream< _CharT, _Traits > ostream_type
Public typedef.