从cython使用C ++标准std :: string的最佳方法是什么?最后的cython发行版应该会让它变得简单,但我想知道为什么有std :: vector的包装器而不是std :: string ......
答案 0 :(得分:11)
Cython 0.16 includes wrappers for std::string,可以导入:
from libcpp.string cimport string
答案 1 :(得分:8)
cdef extern from "string" namespace "std":
cdef cppclass string:
char* c_str()
这不是一个完整的解决方案,但仍然可以做到这一点。