1 #ifndef BOOST_ARCHIVE_ITERATORS_HEAD_ITERATOR_HPP
2 #define BOOST_ARCHIVE_ITERATORS_HEAD_ITERATOR_HPP
4 // MS compatible compilers support #pragma once
9 /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
12 // (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
13 // Use, modification and distribution is subject to the Boost Software
14 // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
15 // http://www.boost.org/LICENSE_1_0.txt)
17 // See http://www.boost.org for updates, documentation, and revision history.
19 #include <boost/iterator/iterator_adaptor.hpp>
20 #include <boost/iterator/iterator_traits.hpp>
26 template<class Predicate, class Base>
28 : public boost::iterator_adaptor<
29 head_iterator<Predicate, Base>,
32 single_pass_traversal_tag
36 friend class iterator_core_access;
37 typedef boost::iterator_adaptor<
38 head_iterator<Predicate, Base>,
41 single_pass_traversal_tag
44 typedef head_iterator<Predicate, Base> this_t;
45 typedef super_t::value_type value_type;
46 typedef super_t::reference reference_type;
48 reference_type dereference_impl(){
50 while(! m_predicate(* this->base_reference()))
51 ++ this->base_reference();
54 return * this->base_reference();
57 reference_type dereference() const {
58 return const_cast<this_t *>(this)->dereference_impl();
64 Predicate m_predicate;
68 head_iterator(Predicate f, T start) :
76 } // namespace iterators
77 } // namespace archive
80 #endif // BOOST_ARCHIVE_ITERATORS_HEAD_ITERATOR_HPP