does boost python support a function returning a vector, by ref or value?

后端 未结 2 1888
半阙折子戏
半阙折子戏 2021-01-03 12:53

I am new to python, I have looked at boost python, and it looks very impressive. However going through the introduction I can not find any examples where, vector of objects

2条回答
  •  时光说笑
    2021-01-03 13:59

    Autopulated's reason was essentially correct, but the code was more complicated then necessary.

    The vector_indexing_suite can do all that work for you:

    class_< std::vector >("VectorOfX")
        .def(vector_indexing_suite< std::vector >() )
        ;
    

    There is a map_indexing_suite as well.

提交回复
热议问题