> C++17 required (and I didn't know this specific syntax worked). AFAIR, this is in fact a C++20 proposal.
Hence best is: for (auto &element : std::as_const(container)) Philippe On Wed, 31 Oct 2018 08:30:28 -0700 Thiago Macieira <thiago.macie...@intel.com> wrote: > On Wednesday, 31 October 2018 03:35:32 PDT Giuseppe D'Angelo via Development > wrote: > > > for (const auto &c = container; auto &element : c) > > > > Why not using this one for *both* lvalues and rvalues? Once more, one > > fewer thing to teach. > > C++17 required (and I didn't know this specific syntax worked). > > -- > Thiago Macieira - thiago.macieira (AT) intel.com > Software Architect - Intel Open Source Technology Center > > > > _______________________________________________ > Development mailing list > Development@qt-project.org > http://lists.qt-project.org/mailman/listinfo/development _______________________________________________ Development mailing list Development@qt-project.org http://lists.qt-project.org/mailman/listinfo/development