1 // Copyright Eric Niebler 2005.
2 // Distributed under the Boost Software License, Version 1.0. (See
3 // accompanying file LICENSE_1_0.txt or copy at
4 // http://www.boost.org/LICENSE_1_0.txt)
5 #ifndef STL_ITERATOR_EAN20051028_HPP
6 # define STL_ITERATOR_EAN20051028_HPP
8 # include <boost/python/detail/prefix.hpp>
10 # include <boost/python/object/stl_iterator_core.hpp>
12 # include <boost/iterator/iterator_facade.hpp>
14 namespace boost
{ namespace python
17 // An STL input iterator over a python sequence
18 template<typename ValueT
>
19 struct stl_input_iterator
20 : boost::iterator_facade
<
21 stl_input_iterator
<ValueT
>
23 , std::input_iterator_tag
32 // ob is the python sequence
33 stl_input_iterator(boost::python::object
const &ob
)
39 friend class boost::iterator_core_access
;
43 this->impl_
.increment();
46 ValueT
dereference() const
48 return extract
<ValueT
>(this->impl_
.current().get())();
51 bool equal(stl_input_iterator
<ValueT
> const &that
) const
53 return this->impl_
.equal(that
.impl_
);
56 objects::stl_input_iterator_impl impl_
;
59 }} // namespace boost::python
61 #endif // STL_ITERATOR_EAN20051028_HPP