<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Tue, Apr 14, 2015 at 10:14 PM, Pete Cooper <span dir="ltr"><<a href="mailto:peter_cooper@apple.com" target="_blank">peter_cooper@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="auto"><div><br><br>Sent from my iPhone</div><span class=""><div><br>On Apr 14, 2015, at 8:21 PM, Richard Trieu <<a href="mailto:rtrieu@google.com" target="_blank">rtrieu@google.com</a>> wrote:<br><br></div><blockquote type="cite"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">> -    for (const auto &MapEntry : VMap) {<br>
> +    for (const auto MapEntry : VMap) {<br>
<br>
What's the deal with this change? Is the type small & trivially<br>
copyable & we're suggesting using values instead of references?</blockquote></blockquote><blockquote type="cite"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div><br>
<br></div></blockquote><div>VMap does not return a reference, so remove the reference type to indicate a copy is always made.</div></blockquote></span>Are there any cases where you'll change something from ref to a value because it's 'small and trivially copyable'?<div><br></div><div>If so, my worry is what happens if I change the type to be a bit larger or less trivial to copy. How will I be able to spot the range based for loop uses (which now do a copy) and change them back to refs? The problem is that changing them back in that way could result in false positives because perhaps in some uses I wanted the copy and in others I didn't.</div><div><br></div><div>So basically, are we able to reliably detect when to do the reverse transformation at a later date, and if not, should we do a transform now that is potentially difficult to undo later?</div><div><br></div><div>Cheers</div><span class=""><font color="#888888"><div>Pete</div></font></span></div></blockquote></div><br></div><div class="gmail_extra">This warning only triggers when a copy is made.  If the reference is bound to something that is not a copy, then this warning will not be issued.  If there is a suggestion to go from reference type to non-reference type, then a copy was already being made.</div></div>