[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    Re: [PyQt] SIP template-based class with argument having default constructor as default value
From:       Shaheed Haque <srhaque () theiet ! org>
Date:       2017-06-18 13:59:00
Message-ID: CAHAc2jeqrDo=Q-b9OC-cz26YAGXy=dVJO-ZydocOCk2yiqh_Mw () mail ! gmail ! com
[Download RAW message or body]

On 15 June 2017 at 23:38, Phil Thompson <phil@riverbankcomputing.com> wrote:
> On 13 Jun 2017, at 3:16 pm, Denis Rouzaud <denis.rouzaud@gmail.com> wrote:
> > 
> > 
> > Hi all,
> > 
> > Title says it all ;)
> > 
> > I think there is an issue on how SIP handles the default value argument for \
> > template-based classes. SIP don't replaces the T var by the implemented  base \
> > class constructor. See below. 
> > Let's say I have
> > 
> > template <typename T>
> > class Base
> > {
> > pubic:
> > Base( const T &epoch = T()) : mEpoch( epoch ){}
> > private:
> > T mEpoch;
> > }
> > 
> > typedef Base< QDate > MyDate;
> > typedef Base< QDateTime > MyDateTime;
> > 
> > 
> > Here is the SIP code generated:
> > 
> > static void *init_type_MyDate(sipSimpleWrapper *, PyObject *sipArgs, PyObject \
> > *sipKwds, PyObject **sipUnused, PyObject **, PyObject **sipParseErr) {
> > MyDate *sipCpp = 0;
> > {
> > const QDate& a0def = T();
> > const QDate* a0 = &a0def;
> > int a0State = 0;
> > ......
> > 
> > 
> > I get an error:
> > use of undeclared identifier 'T'
> > in   const QDate& a0def = T();
> > 
> > 
> > Does someone confirm?
> > Is there a workaround?
> 
> Tonight's snapshot should handle this use case - but you may find others that will \
> require more work.

Phil,

Here, I think, is one of those other cases:

template <T>
class KSharedPixmapCacheMixin: T, KLocalImageCacheImplementation
{
...
};

The problem is that SIP does not like the use of T as a base class:

ERROR: sip: ::T has not been defined while processing
KGuiAddons/KGuiAddonsmod.sip

Thanks, Shaheed


> 
> Phil
> 
> _______________________________________________
> PyQt mailing list    PyQt@riverbankcomputing.com
> https://www.riverbankcomputing.com/mailman/listinfo/pyqt
_______________________________________________
PyQt mailing list    PyQt@riverbankcomputing.com
https://www.riverbankcomputing.com/mailman/listinfo/pyqt


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic