git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203254
91177308-0d34-0410-b5e6-
96231b3b80d8
expensive.
As a rule of thumb, use ``const auto &`` unless you need to mutate or copy the
-result.
+result, and use ``const auto *`` when copying pointers.
.. code-block:: c++
// Remove the reference if you really want a new copy.
for (auto Val : Container) { Val.change(); saveSomewhere(Val); }
+ // Copy pointers, but make it clear that they're pointers.
+ for (const auto *Val : Container) { observe(*Val); }
+ for (auto *Val : Container) { Val->change(); }
+
Style Issues
============