[cfe-dev] Structured bindings seem to allow non-const references to a bitfield

Keane, Erich via cfe-dev cfe-dev at lists.llvm.org
Wed Mar 22 13:14:14 PDT 2017


AH! I get it now.  The ‘auto’/’const auto’/’auto&’ actually applies to an unnamed Structured Binding object, not as a qualifier to the individual items.  A structured binding is more akin to a named tuple rather than introducing values.

I missed that mental model, thank you very much!
-Erich

From: James Dennett [mailto:james.dennett at gmail.com]
Sent: Wednesday, March 22, 2017 1:09 PM
To: Keane, Erich <erich.keane at intel.com>
Cc: cfe-dev <cfe-dev at lists.llvm.org>
Subject: Re: [cfe-dev] Structured bindings seem to allow non-const references to a bitfield

On Wed, Mar 22, 2017 at 12:38 PM, Keane, Erich <erich.keane at intel.com<mailto:erich.keane at intel.com>> wrote:
Ok, I guess I didn’t (don’t completely?) ‘get’ that there is a difference between “structured binding alias” and “reference”.  Additionally, if you simply do “auto”, you get copies, right?

You get (at most) one copy, of the value that's being decomposed, and it is unnamed.

-- James
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20170322/7cb416b7/attachment.html>


More information about the cfe-dev mailing list