mirror of
https://github.com/pybind/pybind11.git
synced 2024-11-25 22:52:01 +00:00
fixed return value type in py::make_iterator
This commit is contained in:
parent
772c6d54d6
commit
1959d18c48
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user