mirror of
https://github.com/pybind/pybind11.git
synced 2024-11-26 07:02:11 +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))) {
|
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++;
|
||||||
|
@ -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();
|
||||||
|
Loading…
Reference in New Issue
Block a user