On quinta-feira, 26 de setembro de 2013 00:34:35, Etienne Sandré-Chardonnal wrote: > Dear all, > > I have a list of pointers : QList<MyClass*> list; > > MyClass has a load() function > > Now I would like to call something like QtConcurrent::map(list, > &Myclass::load), but this does not work, as it would with a list of Myclass > object instead of pointers. > > Is there any way to make this work in one line without a wrapper?
QtConcurrent::map(list, [](MyClass *ptr) { ptr->load(); }); Lambdas are supported in GCC 4.5, Clang 3.1, ICC 12, MSVC 2010. All of those compilers are a couple of years old, so it should be acceptable for you to use lambdas. -- Thiago Macieira - thiago.macieira (AT) intel.com Software Architect - Intel Open Source Technology Center
signature.asc
Description: This is a digitally signed message part.
_______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest