You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by bm...@apache.org on 2015/06/09 02:56:52 UTC

mesos git commit: Updated C++ style guide to avoid POD const reference in foreach.

Repository: mesos
Updated Branches:
  refs/heads/master b24da74e4 -> 88ff5ef50


Updated C++ style guide to avoid POD const reference in foreach.

Review: https://reviews.apache.org/r/35120


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/88ff5ef5
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/88ff5ef5
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/88ff5ef5

Branch: refs/heads/master
Commit: 88ff5ef5042143bb295214b4e92e925bbfbf8252
Parents: b24da74
Author: Joris Van Remoortere <jo...@gmail.com>
Authored: Mon Jun 8 17:54:32 2015 -0700
Committer: Benjamin Mahler <be...@gmail.com>
Committed: Mon Jun 8 17:56:40 2015 -0700

----------------------------------------------------------------------
 docs/mesos-c++-style-guide.md | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/88ff5ef5/docs/mesos-c++-style-guide.md
----------------------------------------------------------------------
diff --git a/docs/mesos-c++-style-guide.md b/docs/mesos-c++-style-guide.md
index 38dd201..94107ed 100644
--- a/docs/mesos-c++-style-guide.md
+++ b/docs/mesos-c++-style-guide.md
@@ -161,13 +161,7 @@ The goal is to make code more concise and improve readability. Use this if an ex
 * Will **not** be invalidated during the lifetime of the alias. Otherwise document this explicitly.
 
 ```
-hashmap<int, hashset<int>> index;
-
-struct T
-{
-  int number;
-  string name;
-};
+hashmap<string, hashset<int>> index;
 
 // 1: Ok.
 const hashset<int>& values = index[2];
@@ -178,9 +172,9 @@ for (auto iterator = index.begin(); iterator != index.end(); ++iterator) {
 }
 
 // 3: Ok.
-foreachpair (const int& key, hashset<int>& values, index) {}
+foreachpair (const string& key, const hashset<int>& values, index) {}
 foreachvalue (const hashset<int>& values, index) {}
-foreachkey (const int& key, index) {}
+foreachkey (const string& key, index) {}
 
 // 4: Avoid aliases in most circumstances as they can be dangerous.
 //    This is an example of a dangling alias!