我正在使用 std::array 为最短路径函数定义 2D 点。
typedef std::array<double, 2> point_xy_t;
typedef std::vector<point_xy_t> path_t;
path_t search(const point_xy_t& start, const point_xy_t& goal);
目前,我最好的解决方案是将点( std::array )转换为 std::vector,并使用 boost::python::vector_indexing_suite 作为:
bpy::class_<std::vector<double> >("Point")
.def(bpy::vector_indexing_suite<std::vector<double> >())
;
bpy::class_<std::vector<std::vector<double>> >("Path")
.def(bpy::vector_indexing_suite<std::vector<std::vector<double>> >())
;
是否可以直接从/到 std::array 到/从 python 索引或转换?