On terça-feira, 29 de novembro de 2016 09:43:56 PST Burak Arslan wrote:
> On 11/28/16 12:54, André Somers wrote:
> > there is nothing wrong with using std containers in a Qt application,
> 
> Aren't qt-branded containers emit-friendly? AFAIK the meaty bits are
> refcounted which makes it a non-issue to pass them around from signals
> to slots (even across thread boundaries). How should one use std
> containers in such cases? wrap everything with a std::shared_ptr  ?

If your signal emits by const-ref, the slot takes the parameter by const-ref 
and it's an intra-thread delivery, then there's actually no copying.

The only copy that may happen is in cross-thread delivery. For each slot whose 
delivery is in another thread, a full set of copies of each of the parameters 
is made, by way of the metatype system. In this case, Qt's containers are more 
interesting because there's no actual copy, only implicit sharing.

-- 
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

Reply via email to