2
我正在使用std :: array来为最短路径函数定义2D点。boost :: python转换std :: array
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 ::数组)到std ::向量,并使用boost ::蟒蛇:: 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 ::数组转换为/从python?
[这](http://stackoverflow.com/a/15940413/1053968)的答案可能会有所帮助。它显示了如何为集合注册自定义转换器,包括多个维度。 –