Commit 1959d18c by Wenzel Jakob

fixed return value type in py::make_iterator

parent 772c6d54
......@@ -1006,7 +1006,7 @@ template <typename Iterator, typename... Extra> iterator make_iterator(Iterator
if (!detail::get_type_info(typeid(state))) {
class_<state>(handle(), "")
.def("__iter__", [](state &s) -> state& { return s; })
.def("__next__", [](state &s) -> decltype(*std::declval<Iterator>()) & {
.def("__next__", [](state &s) -> decltype(*std::declval<Iterator>()) {
if (s.it == s.end)
throw stop_iteration();
return *s.it++;
......
......@@ -285,7 +285,7 @@ public:
bool operator==(const iterator &it) const { return *it == **this; }
bool operator!=(const iterator &it) const { return *it != **this; }
const handle &operator*() const {
handle operator*() const {
if (!ready && m_ptr) {
auto& self = const_cast<iterator &>(*this);
self.advance();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment