Disable std_vector.i?

View: New views
1 Messages — Rating Filter:   Alert me  

Disable std_vector.i?

by Russell E. Owen-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I am having some issues with shadowed constructors that I think are
caused by using std_vector.i

Some of our classes have multiple constructors such as this:
Foo::Foo(std::vector<double> &values)
Foo::Foo(std::vector<boost::shared_ptr<FancyClass> > &fancyClasses)

and our SWIG file wraps the class Foo and also wraps the arguments as so:
%template(VectorDouble) std::vector<double>;
%template(VectorFancyClass)std::vector<boost::shared_ptr<FancyClass> >;

SWIG complains that the latter constructor is shadowed by the former.

As far as I can tell this is because both std::vector<double> and
std::vector<boost::shared_ptr<some fancyclass> > have been templated
after including std_vector.i. Thus SWIG is trying to support all of the
following forms of Foo constructor:
1) an explicitly constructed VectorDouble
2) a python list of doubles (due to std_vector.i and much appreciated)
3) an explicitly constructed VectorFancyClass
4) a python list of FancyClasses (due to std_vector.i and not necessary)
and the two python list versions (2 and 4) are colliding with each other.

I suspect that both Foo constructors are actually available, and that
only case (4) is unavailable. If so, we can live with it. But I would
rather explicitly disable std_vector.i for VectorFancyClass if there is
some easy way to do this.

I realize I could just include std_vector.i at the very end, but that
happens to be a headache due to the way we're including it right now (in
a common .i file shared by all others -- maybe that is a mistake).

Advice?

-- Russell


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Swig-user mailing list
Swig-user@...
https://lists.sourceforge.net/lists/listinfo/swig-user