Namespaces
Variants
Views
Actions

Difference between revisions of "cpp/iterator/istreambuf iterator"

From cppreference.com
< cpp‎ | iterator
m (spacing)
m (typos)
Line 33: Line 33:
 
{{dcl list mem ctor | cpp/iterator/istreambuf_iterator/istreambuf_iterator | constructs a new istreambuf_iterator }}
 
{{dcl list mem ctor | cpp/iterator/istreambuf_iterator/istreambuf_iterator | constructs a new istreambuf_iterator }}
 
{{dcl list mem dtor | nolink=true| destructs an istreambuf_iterator | notes={{mark implicit}} }}
 
{{dcl list mem dtor | nolink=true| destructs an istreambuf_iterator | notes={{mark implicit}} }}
{{dcl list mem fun | cpp/iterator/istreamubuf_iterator/operator* | title=operator*<br>operator-> | obtains a copy of the current character<br>accesses a member of the current character, if {{tt|CharT}} has members | notes=<br>{{mark since c++11}}}}
+
{{dcl list mem fun | cpp/iterator/istreambuf_iterator/operator* | title=operator*<br>operator-> | obtains a copy of the current character<br>accesses a member of the current character, if {{tt|CharT}} has members | notes=<br>{{mark since c++11}}}}
{{dcl list mem fun | cpp/iterator/istreamubuf_iterator/operator++ | title=operator++<br>operator++(int) | advances the istreambuf_iterator }}
+
{{dcl list mem fun | cpp/iterator/istreambuf_iterator/operator++ | title=operator++<br>operator++(int) | advances the istreambuf_iterator }}
{{dcl list mem fun | cpp/iterator/istreamubuf_iterator/equal | tests if both istreambuf_iterators are end-of-stream or if both are valid}}
+
{{dcl list mem fun | cpp/iterator/istreambuf_iterator/equal | tests if both istreambuf_iterators are end-of-stream or if both are valid}}
 
{{dcl list end}}
 
{{dcl list end}}
  

Revision as of 19:22, 17 January 2012

Template:cpp/iterator/istreambuf iterator/sidebar Template:ddcl list begin <tr class="t-dsc-header">

<td>
Defined in header <iterator>
</td>

<td></td> <td></td> </tr> <tr class="t-dcl ">

<td class="t-dcl-nopad">
template< class CharT, class Traits = std::char_traits<CharT> >

class istreambuf_iterator : public std::iterator< std::input_iterator_tag,
                                                  CharT,
                                                  typename Traits::off_type,
                                                  /* unspecified, usually CharT* */,

                                                  CharT >
</td>

<td class="t-dcl-nopad"> </td> <td class="t-dcl-nopad"> </td> </tr> Template:ddcl list end

std::istreambuf_iterator is a single-pass input iterator that reads successive characters from the Template:cpp object for which it was constructed. The actual read operation is performed when the iterator is incremented, not when it is dereferenced. The first character may be read when the iterator is constructed or when the first dereferencing is done. Otherwise, dereferencing only returns a copy of the most recently read character.

The default-constructed std::istreambuf_iterator is known as the end-of-stream iterator. When a valid std::istreambuf_iterator reaches the end of the underlying stream, it becomes equal to the end-of-stream iterator. Dereferencing or incrementing it further invokes undefined behavior.

std::istreambuf_iterator has a trivial copy constructor, a constexpr default constructor, and a trivial destructor.

Contents

Member types

Template:tdcl list begin Template:tdcl list hitem Template:tdcl list item Template:tdcl list item Template:tdcl list item Template:tdcl list item Template:tdcl list item Template:tdcl list end

Member functions

constructs a new istreambuf_iterator
(public member function)
(destructor)
(implicitly declared)
destructs an istreambuf_iterator
(public member function)
obtains a copy of the current character
accesses a member of the current character, if CharT has members
(public member function)
advances the istreambuf_iterator
(public member function)
tests if both istreambuf_iterators are end-of-stream or if both are valid
(public member function)

Non-member functions

compares two istreambuf_iterators
(function template)

Example

Template:example cpp

See also

Template:cpp/iterator/dcl list ostreambuf iteratorTemplate:cpp/iterator/dcl list istream iterator