Adds type_caster support for std::deque. (#1609)

* Adds std::deque to the types supported by list_caster in stl.h.
* Adds a new test_deque test in test_stl.{py,cpp}.
* Updates the documentation to include std::deque as a default
  supported type.
This commit is contained in:
voxmea
2018-11-16 00:45:19 -05:00
committed by Wenzel Jakob
parent 8f5b7fce84
commit 17983e7425
4 changed files with 18 additions and 1 deletions

View File

@@ -23,6 +23,15 @@ def test_vector(doc):
assert m.cast_ptr_vector() == ["lvalue", "lvalue"]
def test_deque(doc):
"""std::deque <-> list"""
lst = m.cast_deque()
assert lst == [1]
lst.append(2)
assert m.load_deque(lst)
assert m.load_deque(tuple(lst))
def test_array(doc):
"""std::array <-> list"""
lst = m.cast_array()