Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(982)

Unified Diff: styleguide/c++/c++11.html

Issue 1675483002: Allow use of container cbegin() and cend() methods, plus sample uses. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add note about non-member cbegin() and cend(). Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/views/toolbar/browser_actions_container.cc ('k') | ui/views/view_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: styleguide/c++/c++11.html
diff --git a/styleguide/c++/c++11.html b/styleguide/c++/c++11.html
index 239a282a13626484e39051dbe752e4fd6c3fd2e0..27d37b6c5a222caf5c4c9f6de02b4fd1161c0a30 100644
--- a/styleguide/c++/c++11.html
+++ b/styleguide/c++/c++11.html
@@ -357,13 +357,10 @@ Note that &lt;algorithm&gt; contains a range-based <code>move</code> method. Th
<tr>
<td>Begin and End Non-Member Functions</td>
<td><code>std::begin()</code> and <code>std::end()</code></td>
-<td>Allows use of free functions on any container, including
-fixed-size arrays</td>
-<td><a href="http://en.cppreference.com/w/cpp/iterator/begin">
-std::begin</a> and
-<a href="http://en.cppreference.com/w/cpp/iterator/end">
-std::end</a></td>
-<td>Useful for fixed-size arrays. <a href="https://groups.google.com/a/chromium.org/d/topic/cxx/5iFNE8P5qT4/discussion">Discussion thread</a></td>
+<td>Allows use of free functions on any container, including fixed-size arrays</td>
+<td><a href="http://en.cppreference.com/w/cpp/iterator/begin">std::begin</a> and <a href="http://en.cppreference.com/w/cpp/iterator/end">std::end</a></td>
+<td>Useful for fixed-size arrays. <a href="https://groups.google.com/a/chromium.org/d/topic/cxx/5iFNE8P5qT4/discussion">Discussion thread</a><br>
+Note that non-member <code>cbegin()</code> and <code>cend()</code> are not available until C++14.</td>
</tr>
<tr>
@@ -375,6 +372,14 @@ std::end</a></td>
</tr>
<tr>
+<td>Constant Iterator Methods on Containers</td>
+<td><code>std::vector::cbegin()</code>, <code>std::vector::cend()</code></td>
+<td>Allows more widespread use of <code>const_iterator</code></td>
+<td>E.g. <a href="http://en.cppreference.com/w/cpp/container/vector/begin">std::vector::cbegin<a> and <a href="http://en.cppreference.com/w/cpp/container/vector/end">std::vector::cend<a></td>
+<td>Applies to all containers, not just <code>vector</code>. Consider using <code>const_iterator</code> over <code>iterator</code> where possible for the same reason as using <code>const</code> variables and functions where possible; see Effective Modern C++ item 13 for motivation. <a href="https://groups.google.com/a/chromium.org/d/topic/cxx/cS83F_buqLM/discussion">Discussion thread</a></td>
+</tr>
+
+<tr>
<td>Containers containing movable types</td>
<td><code>vector&lt;scoped_ptr&gt;</code></td>
<td>Enables containers that contain move-only types like <code>scoped_ptr</code></td>
@@ -846,14 +851,6 @@ the <code>&lt;complex&gt;</code> library.</td>
</tr>
<tr>
-<td>Constant Iterator Methods on Containers</td>
-<td><code>std::vector::cbegin()</code> and <code>std::vector::cend()</code></td>
-<td>Enforces iteration methods that don't change container contents</td>
-<td><a href="http://en.cppreference.com/w/cpp/container/vector/begin">std::vector::cbegin<a></td>
-<td>This applies to all containers, std::vector is just an example. <a href="https://groups.google.com/a/chromium.org/d/topic/cxx/cS83F_buqLM/discussion">Discussion thread</a></td>
-</tr>
-
-<tr>
<td>Container Compaction Functions</td>
<td><code>std::vector::shrink_to_fit()</code>,
<code>std::deque::shrink_to_fit()</code>, and
« no previous file with comments | « chrome/browser/ui/views/toolbar/browser_actions_container.cc ('k') | ui/views/view_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698