系列文章
【pybind11笔记】eigen与numpy数据交互
【pybind11笔记】python调用c++函数
【pybind11笔记】python调用c++结构体
【pybind11笔记】python调用c++类
为自定义类型创建绑定
现在,让我们看一个更复杂的示例,在该示例中,我们将为名为的自定义C ++数据结构创建绑定Pet。其定义如下:
struct Pet {
Pet(const std::string &name) : name(name) {
}
void setName(const std::string &name_) {
name = name_; }
const std::string &getName() const {
return name; }
std::string name