From f763a99a501650eff2c60288aa6f10ef916d769e Mon Sep 17 00:00:00 2001 From: DongHun Kwak Date: Thu, 6 Oct 2016 10:41:18 +0900 Subject: Imported Upstream version 1.62.0 Change-Id: I9d4c1ddb7b7d8f0069217ecc582700f9fda6dd4c Signed-off-by: DongHun Kwak --- doc/html/boost/eof_iterator.html | 56 +++++++++++++++++++++++----------------- 1 file changed, 32 insertions(+), 24 deletions(-) (limited to 'doc/html/boost/eof_iterator.html') diff --git a/doc/html/boost/eof_iterator.html b/doc/html/boost/eof_iterator.html index 8ff530baec..19f83477e3 100644 --- a/doc/html/boost/eof_iterator.html +++ b/doc/html/boost/eof_iterator.html @@ -4,7 +4,7 @@ Class template eof_iterator - + @@ -38,60 +38,68 @@ { public: // construct/copy/destruct - eof_iterator(); + eof_iterator(); - // protected member functions - ValueType & value(); - void found_eof(); + // protected member functions + ValueType & value(); + void found_eof(); - // private member functions - void increment(); - bool equal(const eof_iterator &) const; - const ValueType & dereference() const; + // private member functions + void increment(); + bool equal(const eof_iterator &) const; + const ValueType & dereference() const; };
-

Description

-

The 'eof_iterator' class is useful for constructing forward iterators in cases where iterator extract data from some source and it's easy to detect 'eof' \-- i.e. the situation where there's no data. One apparent example is reading lines from a file.

+

Description

+

The 'eof_iterator' class is useful for constructing forward iterators in cases where iterator extract data from some source and it's easy to detect 'eof' -- i.e. the situation where there's no data. One apparent example is reading lines from a file.

Implementing such iterators using 'iterator_facade' directly would require to create class with three core operation, a couple of constructors. When using 'eof_iterator', the derived class should define only one method to get new value, plus a couple of constructors.

The basic idea is that iterator has 'eof' bit. Two iterators are equal only if both have their 'eof' bits set. The 'get' method either obtains the new value or sets the 'eof' bit.

Specifically, derived class should define:

-

1. A default constructor, which creates iterator with 'eof' bit set. The constructor body should call 'found_eof' method defined here. 2. Some other constructor. It should initialize some 'data pointer' used in iterator operation and then call 'get'. 3. The 'get' method. It should operate this way:

-
    +
      +
    1. A default constructor, which creates iterator with 'eof' bit set. The constructor body should call 'found_eof' method defined here.

    2. +
    3. Some other constructor. It should initialize some 'data pointer' used in iterator operation and then call 'get'.

    4. +
    5. +

      The 'get' method. It should operate this way:

      +
      • look at some 'data pointer' to see if new element is available; if not, it should call 'found_eof'.

      • extract new element and store it at location returned by the 'value' method.

      • advance the data pointer.

      +
    6. +
    +

    +

    Essentially, the 'get' method has the functionality of both 'increment' and 'dereference'. It's very good for the cases where data extraction implicitly moves data pointer, like for stream operation.

    -

    +

    eof_iterator public construct/copy/destruct

    -
    1. eof_iterator();
    +
    1. eof_iterator();
    -

    -eof_iterator protected member functions

    +

    +eof_iterator protected member functions

    1. -
      ValueType & value();
      +
      ValueType & value();

      Returns the reference which should be used by derived class to store the next value.

    2. -
      void found_eof();
      +
      void found_eof();

      Should be called by derived class to indicate that it can't produce next element.

    -

    -eof_iterator private member functions

    +

    +eof_iterator private member functions

      -
    1. void increment();
    2. -
    3. bool equal(const eof_iterator & other) const;
    4. -
    5. const ValueType & dereference() const;
    6. +
    7. void increment();
    8. +
    9. bool equal(const eof_iterator & other) const;
    10. +
    11. const ValueType & dereference() const;
-- cgit v1.2.3