vs-code-cython icon indicating copy to clipboard operation
vs-code-cython copied to clipboard

Type vector[char*] is not identified.

Open koukou4 opened this issue 1 year ago • 1 comments

Type vector[char*] is not identified. However the code can be compiled and execute. Here is an example.

from libcpp.vector cimport vector from libcpp.string cimport string from libc.stdlib cimport malloc, free from libc.string cimport strcpy, strlen

cpdef vector[char*] py_list_to_cpp_vector_char(list py_list): cdef vector[char*] cpp_vector cdef char* c_string for py_str in py_list: c_string = <char*>malloc(len(py_str) + 1) strcpy(c_string, py_str.encode('utf-8')) cpp_vector.push_back(c_string) return cpp_vector

koukou4 avatar Jan 17 '24 08:01 koukou4