By moving it instead ?


-------
Jean-Michaël Celerier
http://www.jcelerier.name

On Thu, Aug 10, 2017 at 12:05 AM, Thiago Macieira <thiago.macie...@intel.com
> wrote:

> On quarta-feira, 9 de agosto de 2017 08:04:16 PDT Nikos Chantziaras wrote:
> > It seems that connect() is copying its lambda parameter around. That
> > means that if a lambda capture contains a non-copyable object, like a
> > unique_ptr, connect() cannot be used:
> >
> >    {
> >        auto ptr = std::make_unique<int>(0);
> >        connect(this, &MyQObject::mySignal,
> >                [ptr = std::move(ptr)]() mutable { });
> >    }
>
> How do you propose we keep the connection alive after the scope ends, if we
> don't copy the lambda?
>
> --
> Thiago Macieira - thiago.macieira (AT) intel.com
>   Software Architect - Intel Open Source Technology Center
>
> _______________________________________________
> Interest mailing list
> Interest@qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest
>
_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest

Reply via email to