(Adding back the mailing list) Den lör 20 okt. 2018 kl 23:54 skrev Elvis Stansvik <elvst...@gmail.com>: > > Den lör 20 okt. 2018 kl 23:50 skrev Giuseppe D'Angelo > <giuseppe.dang...@kdab.com>: > > > > Il 20/10/18 19:37, Elvis Stansvik ha scritto: > > > If the C++ wizards considered this but were hesitant, then I think > > > it's right that Qt is hesitant as well. I hadn't really considered > > > potential life-time issues, so I guess what we're doing might possibly > > > be unsafe (?). > > > > Probably in the sense that the function you pasted can be applied like this: > > > > QVector<Obj> v; > > for (auto &o : qMoveAsConst(v)) ~~~; // compiles with an lvalue! > > use(v); // unspecified behavior > > Ah yes, it may be that the standards folks simply didn't want this > because of foot-shooting potential like this.
Another potential foot-shooter I found on an SO question (https://stackoverflow.com/a/39051612/252857): for (auto const &&value : as_const(getQString())) // whoops! { } Elvis > > > > > > > > What's GCE? Some optimization? (Google "c++ gce" didn't give me anything). > > > > Guaranteed Copy Elision: > > > > > https://en.cppreference.com/w/cpp/language/copy_elision > > Thanks! > > Elvis > > > > > My 2 c, > > > > -- > > Giuseppe D'Angelo | giuseppe.dang...@kdab.com | Senior Software Engineer > > KDAB (France) S.A.S., a KDAB Group company > > Tel. France +33 (0)4 90 84 08 53, http://www.kdab.com > > KDAB - The Qt, C++ and OpenGL Experts > > _______________________________________________ Development mailing list Development@qt-project.org http://lists.qt-project.org/mailman/listinfo/development