Browse Source

iterator over bitvectors added (iterating now mimicks the cpp behavior)

refactoring
Sebastian Junges 5 years ago
parent
commit
a17dfa107b
  1. 3
      src/storage/bitvector.cpp

3
src/storage/bitvector.cpp

@ -30,6 +30,9 @@ void define_bitvector(py::module& m) {
}) })
.def("__setitem__", [](BitVector& b, uint_fast64_t i, bool v) { b.set(i, v); }) .def("__setitem__", [](BitVector& b, uint_fast64_t i, bool v) { b.set(i, v); })
.def("__iter__", [](const BitVector &b) { return py::make_iterator(b.begin(), b.end()); },
py::keep_alive<0, 1>() /* Essential: keep object alive while iterator exists */)
.def(py::self == py::self) .def(py::self == py::self)
.def(py::self != py::self) .def(py::self != py::self)

Loading…
Cancel
Save