fixed return value type in py::make_iterator

This commit is contained in:
Wenzel Jakob 2016-04-30 21:10:27 +02:00
parent 772c6d54d6
commit 1959d18c48
2 changed files with 2 additions and 2 deletions

View File

@ -1006,7 +1006,7 @@ template <typename Iterator, typename... Extra> iterator make_iterator(Iterator
if (!detail::get_type_info(typeid(state))) { if (!detail::get_type_info(typeid(state))) {
class_<state>(handle(), "") class_<state>(handle(), "")
.def("__iter__", [](state &s) -> state& { return s; }) .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) if (s.it == s.end)
throw stop_iteration(); throw stop_iteration();
return *s.it++; return *s.it++;

View File

@ -285,7 +285,7 @@ public:
bool operator==(const iterator &it) const { return *it == **this; } bool operator==(const iterator &it) const { return *it == **this; }
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) { if (!ready && m_ptr) {
auto& self = const_cast<iterator &>(*this); auto& self = const_cast<iterator &>(*this);
self.advance(); self.advance();