]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/python/src/object/stl_iterator.cpp
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)
7 // Andreas Kl\:ockner for fixing increment() to handle
10 #include <boost/python/object.hpp>
11 #include <boost/python/handle.hpp>
12 #include <boost/python/object/stl_iterator_core.hpp>
14 namespace boost
{ namespace python
{ namespace objects
17 stl_input_iterator_impl::stl_input_iterator_impl()
23 stl_input_iterator_impl::stl_input_iterator_impl(boost::python::object
const &ob
)
24 : it_(ob
.attr("__iter__")())
30 void stl_input_iterator_impl::increment()
32 this->ob_
= boost::python::handle
<>(
33 boost::python::allow_null(PyIter_Next(this->it_
.ptr())));
35 throw boost::python::error_already_set();
38 bool stl_input_iterator_impl::equal(stl_input_iterator_impl
const &that
) const
40 return !this->ob_
== !that
.ob_
;
43 boost::python::handle
<> const &stl_input_iterator_impl::current() const
48 }}} // namespace boost::python::objects