【发布时间】:2016-07-08 20:08:34
【问题描述】:
假设我有一个类 Foo:
class Foo {
private:
std::string bar;
public:
Foo () {}
Foo (const std::string& bar_) { this->bar = bar_; }
std::string get_bar () { return this->bar; }
};
还有一个 Foo python 包装器 FooWrapper.pyx:
from libcpp.string cimport string
cdef extern from "Foo.h":
cdef cppclass Foo:
Foo ()
Foo (string)
是否可以在.pyx文件中访问std::string bar而不修改Foo?
【问题讨论】: