[Qt-interest] QtConcurrent::run inside classes

Thiago Macieira thiago.macieira at trolltech.com
Mon May 4 15:46:12 CEST 2009


Em Segunda-feira 04 Maio 2009, às 14:36:11, Stefan Bisplinghoff escreveu:
> > On compile time, I get a lot of C2780 errors (X args expected, 2 args
> > supported, X in [1,3..7]) for the run function.
>
> Well, I covered one solution now by getting the hello function static.
> Is there a reason, why this is necessary?

Because if it's not static, then it needs a "this" pointer. The syntax for 
that is slightly different, but also possible:

                QFuture<void> f1 = run(this, SomeClass::hello,
                                        QString("Alice"));

Concurrent supports running function pointers, pointers-to-member-functions 
(provided the object is passed too, either as a const-ref or as a pointer) and 
functors.

-- 
Thiago Macieira - thiago.macieira (AT) nokia.com
  Senior Product Manager - Nokia, Qt Software
     Sandakerveien 116, NO-0402 Oslo, Norway
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090504/b459ca21/attachment.bin 


More information about the Qt-interest-old mailing list