summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: ac4c4a8)
raw | patch | inline | side by side (parent: ac4c4a8)
author | Duncan P. N. Exon Smith <dexonsmith@apple.com> | |
Fri, 7 Mar 2014 17:23:29 +0000 (17:23 +0000) | ||
committer | Duncan P. N. Exon Smith <dexonsmith@apple.com> | |
Fri, 7 Mar 2014 17:23:29 +0000 (17:23 +0000) |
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203254 91177308-0d34-0410-b5e6-96231b3b80d8
docs/CodingStandards.rst | patch | blob | history |
index a762bf358e3e8b8eb6ec5cd78d117be0808a02f9..f9685d69ad5d7532bad189b78b4228cc825dcec0 100644 (file)
--- a/docs/CodingStandards.rst
+++ b/docs/CodingStandards.rst
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
============