From: William S F. <ws...@fu...> - 2009-04-30 06:19:20
|
Josh Cherry wrote: > > On Wed, 29 Apr 2009, Anton Deguet wrote: > > > I am running into an odd little problem and need some help. I have a > > C++ class with an overload "=" operators which is not strictly > > equivalent to a copy constructor. We use this for vectors and > matrices. > > The "=" operator only performs a copy of the data and will throw an > > exception if the sizes of operands don't match. For example: > > Try this: > > %feature("valuewrapper") MyClassName; > > SWIG can deal with things like non-public assignment operators, and this > should invoke that mechanism. > Also take a look at the 'optimal' attribute in the 'out' typemap. This is usually used to optimise return by value avoiding all copy constructors and assignment operators, but can equally be used for your purpose. See http://www.swig.org/Doc1.3/Typemaps.html#Typemaps_optimal. William |