xiayu 发表于 2018-8-4 11:35:58

c++ python交互之boost.python 简集之 vector处理

#include <boost/python.hpp>  #include <boost/python/suite/indexing/vector_indexing_suite.hpp>
  #include "src.cpp"
  using namespace boost::python;
  BOOST_PYTHON_MODULE(test)
  {
  class_<dvec>("pyvector")
  .def( vector_indexing_suite<dvec > () )
  ;
  class_<std::vector<dvec> >("pyvector_vec")
  .def( vector_indexing_suite< std::vector<dvec> > () )
  ;
  def("a",A);
  }
  python调用代码:test.py
页: [1]
查看完整版本: c++ python交互之boost.python 简集之 vector处理