On Friday 22 January 2016 17:44:40 Thiago Macieira wrote: > On Friday 22 January 2016 11:14:47 Marc Mutz wrote: > > On Friday 22 January 2016 09:57:00 Иван Комиссаров wrote: > > > What > > > i'm missing? > > > > You haven't done the exercise with the int first. > > Here's the exercise with int. This is thread-safe: > > int f() > { > return 1; > } > > auto x = f(); > ++x; > > No matter how many threads call f(), all of them will get a value from f, > can assign it to a variable and modify without caring what other threads > do. > > Replace int with QMap or QString and you have the same behaviour.
This part of the discussion was about copying a container. You return a new instance instead. Returning a new instance does not copy, nor move, due to NRVO. -- Marc Mutz <marc.m...@kdab.com> | Senior Software Engineer KDAB (Deutschland) GmbH & Co.KG, a KDAB Group Company Tel: +49-30-521325470 KDAB - The Qt Experts _______________________________________________ Development mailing list Development@qt-project.org http://lists.qt-project.org/mailman/listinfo/development