Commit 8358831b authored by Stefan Behnel's avatar Stefan Behnel

merge

parents 09a9be1d 93ed6796
...@@ -21,13 +21,13 @@ cdef string {{cname}}(object o) except *: ...@@ -21,13 +21,13 @@ cdef string {{cname}}(object o) except *:
#cimport cython #cimport cython
#from libcpp.string cimport string #from libcpp.string cimport string
cdef extern from *: cdef extern from *:
cdef cppclass string "const std::string": cdef cppclass string "std::string":
char* data() char* data()
size_t size() size_t size()
cdef object __Pyx_PyObject_FromStringAndSize(char*, size_t) cdef object __Pyx_PyObject_FromStringAndSize(char*, size_t)
@cname("{{cname}}") @cname("{{cname}}")
cdef object {{cname}}(string& s): cdef object {{cname}}(const string& s):
return __Pyx_PyObject_FromStringAndSize(s.data(), s.size()) return __Pyx_PyObject_FromStringAndSize(s.data(), s.size())
...@@ -91,11 +91,9 @@ cdef extern from *: ...@@ -91,11 +91,9 @@ cdef extern from *:
bint operator!=(const_iterator) bint operator!=(const_iterator)
const_iterator begin() const_iterator begin()
const_iterator end() const_iterator end()
cdef cppclass const_cpp_list "const std::list" [T] (cpp_list):
pass
@cname("{{cname}}") @cname("{{cname}}")
cdef object {{cname}}(const_cpp_list[X]& v): cdef object {{cname}}(const cpp_list[X]& v):
o = [] o = []
cdef cpp_list[X].const_iterator iter = v.begin() cdef cpp_list[X].const_iterator iter = v.begin()
while iter != v.end(): while iter != v.end():
...@@ -134,11 +132,9 @@ cdef extern from *: ...@@ -134,11 +132,9 @@ cdef extern from *:
bint operator!=(const_iterator) bint operator!=(const_iterator)
const_iterator begin() const_iterator begin()
const_iterator end() const_iterator end()
cdef cppclass const_cpp_set "const std::{{maybe_unordered}}set" [T](cpp_set):
pass
@cname("{{cname}}") @cname("{{cname}}")
cdef object {{cname}}(const_cpp_set[X]& s): cdef object {{cname}}(const cpp_set[X]& s):
o = set() o = set()
cdef cpp_set[X].const_iterator iter = s.begin() cdef cpp_set[X].const_iterator iter = s.begin()
while iter != s.end(): while iter != s.end():
...@@ -166,12 +162,12 @@ cdef pair[X,Y] {{cname}}(object o) except *: ...@@ -166,12 +162,12 @@ cdef pair[X,Y] {{cname}}(object o) except *:
{{template_type_declarations}} {{template_type_declarations}}
cdef extern from *: cdef extern from *:
cdef cppclass pair "const std::pair" [T, U]: cdef cppclass pair "std::pair" [T, U]:
T first T first
U second U second
@cname("{{cname}}") @cname("{{cname}}")
cdef object {{cname}}(pair[X,Y]& p): cdef object {{cname}}(const pair[X,Y]& p):
return X_to_py(p.first), Y_to_py(p.second) return X_to_py(p.first), Y_to_py(p.second)
......
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