[Development] qMoveToConst helper for rvalue references to movable Qt containers?

Philippe philwave at gmail.com
Wed Oct 31 16:52:10 CET 2018


> 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.macieira at 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 at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/development





More information about the Development mailing list