vs-code-cython
vs-code-cython copied to clipboard
Type vector[char*] is not identified.
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