Gonzalo Garramu=C3=B1o wrote:
> What swig complains about is correct. Swig knows nothing about the=20
> stl iterator class, so it cannot inherit from them. Unlike STL=20
> classes, the STL really does not define what or where iterator=20
> classes are to be defined, so swig cannot do much about them. For=20
> swig to be aware of the actual iterator class you have to include the=20
> .h file where they are defined and only then would swig know (or use=20
> the -includeall option, which may be counterproductive). How=20
> iterators are defined is platform specific. On linux, you may find=20
> them in a place like bits/vector.h or bits/iterators.h perhaps. To=20
> deal with iterators, SWIG's standard stl uses a %typemap to translate=20
> back and forth between, say, a const_iterator and, a special iterator=20
> template class like say, a PyIterator_T on python or a RubyIterator_T=20
> on ruby (see the swig .swg include files about them), which then=20
> returns an abstract non-template class pointer of type PyIterator*.=20
Thanks a lot for the explanation, now I understand why swig can't just wrap
> If your iterator class is similar to those of the STL, you can=20
> probably avoid wrapping your iterator class and use a similar=20
> approach with a proxy class of your own and do the appropriate=20
> translation with your own typemap.
Ok, I definitely have to read more about typemaps in the Swig documentation=
The way with a proxy class sounds good to me, let be clarify some things fo=
- When I can avoid wrapping the SkipNullIterator and use a proxy class, doe=
that mean the whole const_iterator problem remain in the DLL wrapper code,
so I do not have to deal with wrapping an STL iterator?
- the World class has a method with a return type of the problematic
SkipNullIterator. When I create a proxy class, say "MyNewIterator", does
that mean in Java (for which I must create the wrapper) the World class doe=
return "MyNewIterator" instead of "SkipNullIterator"?
- I don't quite understand the concept of a proxy class, must I write a new
C++ class, that I put directly into my interface file for Swig? What must
this proxy class do, and how can I tell Swig to generate a wrapper for the
World class, which in turn uses my proxy class instead of the
I know these are a lot of beginner questions, but I appreciate any help or
hints you can give me.
Thanks a lot!
View this message in context: http://www.nabble.com/Problematic-template-cl=
Sent from the swig-user mailing list archive at Nabble.com.