On Sun, 21 Mar 2010 11:09:19 +0100, Philip Lorenz <[email protected]> wrote: > 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.
Do you want to define a template to SIP, or are you only interested in the <MyType> version? If the latter then... %ModuleHeaderCode typedef std::set<MyType>::iterator MyTypeSetIterator; %End %MappedType MyTypeSetIterator ... %End If the former then the following might work... %ModuleHeaderCode typedef std::set<T>::iterator std::set_iterator<T> %End template<T> %MappedType std::set_iterator<T> ... %End Phil _______________________________________________ PyQt mailing list [email protected] http://www.riverbankcomputing.com/mailman/listinfo/pyqt
