Quantcast

%varargs with %template

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

%varargs with %template

Anton Deguet
Hello,

I have a method of a templated class using va_list.  Since I instantiate
my templated class for multiple types, I have a SWIG macro on top of
everything.  The current code doesn't seem to work:

// For va_list in Assign
%varargs(10, elementType = 0)
vctDynamicVectorBase<vctDynamicVectorOwner<elementType>,
elementType>::Assign;
%varargs(10, elementType = 0)
vctDynamicVectorBase<vctDynamicVectorRefOwner<elementType>,
elementType>::Assign;

// Instantiate base for different owners
%template(##name##Base)
vctDynamicVectorBase<vctDynamicVectorOwner<elementType>, elementType>;
%template(##name##RefBase)
vctDynamicVectorBase<vctDynamicVectorRefOwner<elementType>,
elementType>;

I use the macro with elementType = double or int.

In my C++ code, the Assign method has the signature:
inline ThisType & Assign(elementType element0, elementType
element1, ...) throw(std::runtime_error) { /* code here */ }

The generated code compiles but the Assign fails, i.e. the first two
values on the stack are retrieved correctly but the third one is
garbage.  Any clue?

Anton


--
Anton Deguet <[hidden email]>
ERC CISST Johns Hopkins University



-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc.
Get Certified Today * Register for a JBoss Training Course
Free Certification Exam for All Training Attendees Through End of 2005
Visit http://www.jboss.com/services/certification for more information
_______________________________________________
Swig-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/swig-user
Loading...