On quinta-feira, 19 de janeiro de 2017 16:18:30 PST Grégoire Barbier wrote:
> > The return value is interesting still.
> 
> With lambdas the return value itself can be replaced with a captured
> reference, isn't it ?
> Anyway it's still convenient to have it when calling plain old methods
> rather than lambdas.

Hmm... right. What I had proposed:

       QMetaObject::invokeMethod(object, [=]() { 
                doSomething(); return something; },
                Qt::BlockingQueuedConnection,
                Q_RETURN_ARG(foo));

Could be rewritten as:

       QMetaObject::invokeMethod(object, [=, &foo]() { 
                doSomething(); foo = something; },
                Qt::BlockingQueuedConnection);

And that allows us to drop the Q_RETURN_ARG ugliness. That's much better.

PS: should we invert the argument order and have the connection type appear 
before the functor? I find it ugly to have a lambda in the middle of a 
parameter list.

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center

_______________________________________________
Development mailing list
Development@qt-project.org
http://lists.qt-project.org/mailman/listinfo/development

Reply via email to