Commit b74b9630 authored by Robert Bradshaw's avatar Robert Bradshaw

Fix for stl conversions with default template params.

parent 364695bd
...@@ -3393,10 +3393,16 @@ class CStructOrUnionType(CType): ...@@ -3393,10 +3393,16 @@ class CStructOrUnionType(CType):
cpp_string_conversions = ("std::string",) cpp_string_conversions = ("std::string",)
builtin_cpp_conversions = ("std::pair", builtin_cpp_conversions = {
"std::vector", "std::list", # type element template params
"std::set", "std::unordered_set", "std::pair": 2,
"std::map", "std::unordered_map") "std::vector": 1,
"std::list": 1,
"std::set": 1,
"std::unordered_set": 1,
"std::map": 2,
"std::unordered_map": 2,
}
class CppClassType(CType): class CppClassType(CType):
# name string # name string
...@@ -3445,6 +3451,8 @@ class CppClassType(CType): ...@@ -3445,6 +3451,8 @@ class CppClassType(CType):
tags = [] tags = []
declarations = ["cdef extern from *:"] declarations = ["cdef extern from *:"]
for ix, T in enumerate(self.templates or []): for ix, T in enumerate(self.templates or []):
if ix >= builtin_cpp_conversions[self.cname]:
break
if T.is_pyobject or not T.create_from_py_utility_code(env): if T.is_pyobject or not T.create_from_py_utility_code(env):
return False return False
tags.append(T.specialization_name()) tags.append(T.specialization_name())
...@@ -3507,6 +3515,8 @@ class CppClassType(CType): ...@@ -3507,6 +3515,8 @@ class CppClassType(CType):
tags = [] tags = []
declarations = ["cdef extern from *:"] declarations = ["cdef extern from *:"]
for ix, T in enumerate(self.templates or []): for ix, T in enumerate(self.templates or []):
if ix >= builtin_cpp_conversions[self.cname]:
break
if not T.create_to_py_utility_code(env): if not T.create_to_py_utility_code(env):
return False return False
tags.append(T.specialization_name()) tags.append(T.specialization_name())
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment