[C++-sig] wrapping vector of pointers

martin manduch martin.manduch at gmail.com
Tue Jan 26 13:36:13 CET 2010


I need to wrap vector of pointers, because it's parameter in one function...

I have following code:

struct X
    X(int nn) {n=nn;}
    int n;

    class_<X>("X", init<int>())
    .def_readwrite("n", &X::n);

    class_<std::vector<X*> >("XVec")
        .def(vector_indexing_suite<std::vector<X*> >())


I want to make XVec responsible for memory, which is addressed through
pointers, but I don't know how.

>>del a
It prints 1682309121, but I want it to print: 7


More information about the Cplusplus-sig mailing list