123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101 |
- #ifndef BOOST_EOF_ITERATOR_VP_2004_03_12
- #define BOOST_EOF_ITERATOR_VP_2004_03_12
- #include <boost/iterator/iterator_facade.hpp>
- namespace boost {
-
- template<class Derived, class ValueType>
- class eof_iterator : public iterator_facade<Derived, const ValueType,
- forward_traversal_tag>
- {
- public:
- eof_iterator()
- : m_at_eof(false)
- {}
- protected:
-
- ValueType& value()
- {
- return m_value;
- }
-
- void found_eof()
- {
- m_at_eof = true;
- }
- private:
- #ifdef __DCC__
- friend class boost::iterator_core_access;
- #else
- friend class iterator_core_access;
- #endif
- void increment()
- {
- static_cast<Derived&>(*this).get();
- }
- bool equal(const eof_iterator& other) const
- {
- if (m_at_eof && other.m_at_eof)
- return true;
- else
- return false;
- }
- const ValueType& dereference() const
- {
- return m_value;
- }
- bool m_at_eof;
- ValueType m_value;
- };
- }
- #endif
|