mirror of
https://github.com/pybind/pybind11.git
synced 2026-04-20 14:59:27 +00:00
Add lightweight iterators for tuple, list and sequence
Slightly reduces binary size (range for loops over tuple/list benefit a lot). The iterators are compatible with std algorithms.
This commit is contained in:
committed by
Wenzel Jakob
parent
1fac1b9f5f
commit
5637af7b67
@@ -117,3 +117,9 @@ def test_python_iterator_in_cpp():
|
||||
l = [1, None, 0, None]
|
||||
assert m.count_none(l) == 2
|
||||
assert m.find_none(l) is True
|
||||
assert m.count_nonzeros({"a": 0, "b": 1, "c": 2}) == 2
|
||||
|
||||
r = range(5)
|
||||
assert all(m.tuple_iterator(tuple(r)))
|
||||
assert all(m.list_iterator(list(r)))
|
||||
assert all(m.sequence_iterator(r))
|
||||
|
||||
Reference in New Issue
Block a user