[Qt-interest] QSharedPointer cast syntax question

Thiago Macieira thiago at kde.org
Fri Jan 22 18:28:21 CET 2010


Em Sexta-feira 22. Janeiro 2010, às 15.39.21, Felix Nairz escreveu:
> Hi,
> 
> it's definitely a template-noob question but I can't get a
> QSharedPointer cast to work. The compiler keeps complaining...

Could you tell us what exactly it says?

> I have got a function taking a Parameter from a base-class:
> 
> void function( QSharedPointer<BaseType> var)
> 
> In reality the QSharedPointer is holding a type derived from BaseType. I
> want to downcast the shared pointer to the type of the derived class. I
> have tried something like this:
> void function( QSharedPointer<BaseType> var) {
>      QSharedPointer<DerivedType> test( qSharedPointerCast(var) );
> }

qSharedPointerCast<DerivedType>(var)

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
  Senior Product Manager - Nokia, Qt Development Frameworks
      PGP/GPG: 0x6EF45358; fingerprint:
      E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100122/b16d6d5f/attachment.bin 


More information about the Qt-interest-old mailing list