logo       

About using std vector: msg#00056

programming.swig

Subject: About using std vector

I would be grateful for some advice on this apparently simple situation.

I use a std::vector<const double*> to sort a (very long, like 10^6) sequence of objects.

The actual objects are in a container that has a member function like this:

std::vector<const double*> getPointers() const;

I then have my sort function that expects the vector of pointers as an argument, like this:

void sort(std::vector<const double*> &, ...other stuff...);

and will re-order the pointers in the vector according to sorting criteria.

My question / problem is this. In Python, the SWIG wrapping for getPointers
returns a tuple of vectors, which I cannot use as an argument to sort! (I have
done a %template to let SWIG know about std::vector<const double*>)

What should I do?

I could change my member function to this:

void getPointers(std::vector<const double*>&) const;

but this forces me to change an otherwise convenient C++ interface.

Is there an alternative solution that I could consider?


_______________________________________________
Swig maillist - Swig@xxxxxxxxxxxxxxx
http://mailman.cs.uchicago.edu/mailman/listinfo/swig



<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise