如何在cython中使用std :: function

时间:2017-02-27 00:48:48

标签: c++ c++11 cython

我已经看到here你可以做到

from libcpp.string cimport string
from libcpp.vector cimport vector

引用std::stringstd::vector类型的参数。我需要将函数传递给期望std::function<>的c ++方法。我试着做了

from libcpp.function cimport function

但那不起作用:

from libcpp.function cimport function
^
------------------------------------------------------------

cython_topics.pyx:3:0: 'libcpp/function/function.pxd' not found
Traceback (most recent call last):
  File "setup.py", line 18, in <module>
    language="c++",                   # generate and compile C++ code
  File "/usr/lib64/python2.7/site-packages/Cython/Build/Dependencies.py", line 934, in cythonize
    cythonize_one(*args)
  File "/usr/lib64/python2.7/site-packages/Cython/Build/Dependencies.py", line 1056, in cythonize_one
    raise CompileError(None, pyx_file)
Cython.Compiler.Errors.CompileError: cython_topics.pyx

调用c ++函数期望std::function<>的正确方法是什么?

0 个答案:

没有答案