[PyQt] Wrapping a scoped template type

Philip Lorenz lorenzph+sip at in.tum.de
Sun Mar 21 10:09:19 GMT 2010


Hi,

I am trying to wrap a templated scoped type (in my case 
std::set<T>::iterator) using SIP 4.10.0. However I have not yet managed 
to find a solution which solves this case nicely.

According to the SIP reference templates must be of the form template 
::= scoped-name < type-list > which does not fit here.

I have tried to wrap the std::set<T> declaration using a typedef, i.e.:

typedef std::set<T> myset
typedef myset::iterator mysetiterator

but this resulted in a myset is undefined error message.

Hence my current approach is to typedef the iterator to a void * for SIP 
and mapping it to the real type inside a %ModuleHeaderCode:

%ModuleHeaderCode
typedef std::set<MyType>::iterator MyTypeSetIterator;
%End

typedef void * MyTypeSetIterator;


Unfortunately this requires a patched SIP binary as the generated source 
files refer to the type by void * (I am not using the /NoTypeName/ 
annotation) rather than the name specified by the typedef.

I have attached the patch file against SIP which works around the issue 
described above. However I would be very grateful if anyone knows how to 
solve this issue in a nicer way.

Thanks in advance,

Philip Lorenz
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20100321/3413c65d/attachment-0001.html>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: sip_do_not_resolve_type_names.patch
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20100321/3413c65d/attachment-0001.ksh>


More information about the PyQt mailing list