1 // (C) Copyright Gennadiy Rozental 2001.
2 // Distributed under the Boost Software License, Version 1.0.
3 // (See accompanying file LICENSE_1_0.txt or copy at
4 // http://www.boost.org/LICENSE_1_0.txt)
6 // See http://www.boost.org/libs/test for the library home page.
9 //! Input iterator facade
10 // ***************************************************************************
12 #ifndef BOOST_TEST_UTILS_INPUT_ITERATOR_FACADE_HPP
13 #define BOOST_TEST_UTILS_INPUT_ITERATOR_FACADE_HPP
16 #include <boost/iterator/iterator_facade.hpp>
18 #include <boost/test/detail/suppress_warnings.hpp>
20 //____________________________________________________________________________//
26 // ************************************************************************** //
27 // ************** input_iterator_core_access ************** //
28 // ************************************************************************** //
30 class input_iterator_core_access
32 #if defined(BOOST_NO_MEMBER_TEMPLATE_FRIENDS) || BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551))
35 template <class I, class V, class R, class TC> friend class input_iterator_facade;
38 template <class Facade>
39 static bool get( Facade& f )
45 // objects of this class are useless
46 input_iterator_core_access(); //undefined
49 // ************************************************************************** //
50 // ************** input_iterator_facade ************** //
51 // ************************************************************************** //
53 template<typename Derived,
55 typename Reference = ValueType const&,
56 typename Traversal = single_pass_traversal_tag>
57 class input_iterator_facade : public iterator_facade<Derived,ValueType,Traversal,Reference>
61 input_iterator_facade() : m_valid( false ), m_value() {}
63 protected: // provide access to the Derived
75 friend class boost::iterator_core_access;
77 // iterator facade interface implementation
80 // we make post-end incrementation indefinetly safe
82 m_valid = input_iterator_core_access::get( *static_cast<Derived*>(this) );
84 Reference dereference() const
89 // iterator facade interface implementation
90 bool equal( input_iterator_facade const& rhs ) const
92 // two invalid iterator equals, inequal otherwise
93 return !m_valid && !rhs.m_valid;
98 } // namespace unit_test
101 //____________________________________________________________________________//
103 #include <boost/test/detail/enable_warnings.hpp>
105 #endif // BOOST_TEST_UTILS_INPUT_ITERATOR_FACADE_HPP