Repository: mesos
Updated Branches:
  refs/heads/master 4f50c575f -> 339d9f837


Added `initializer_list` constructors for `JSON::(Object|Array)`.

This improves test cleanliness, as it allows inline construction of
expected values with which to perform tests.

Refer to https://reviews.apache.org/r/57336 to see how this is used.

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


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

Branch: refs/heads/master
Commit: 1bab64fce462177651f7fc25a882522a9c3b681c
Parents: 4f50c57
Author: Michael Park <[email protected]>
Authored: Mon Mar 6 17:12:30 2017 -0800
Committer: Michael Park <[email protected]>
Committed: Thu Mar 9 13:45:17 2017 -0800

----------------------------------------------------------------------
 3rdparty/stout/include/stout/json.hpp | 8 ++++++++
 1 file changed, 8 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/1bab64fc/3rdparty/stout/include/stout/json.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/stout/include/stout/json.hpp 
b/3rdparty/stout/include/stout/json.hpp
index b0fd667..be73340 100644
--- a/3rdparty/stout/include/stout/json.hpp
+++ b/3rdparty/stout/include/stout/json.hpp
@@ -152,6 +152,11 @@ private:
 
 struct Object
 {
+  Object() = default;
+
+  Object(std::initializer_list<std::pair<const std::string, Value>> values_)
+    : values(values_) {}
+
   // Returns the JSON value (specified by the type) given a "path"
   // into the structure, for example:
   //
@@ -187,6 +192,9 @@ struct Object
 
 struct Array
 {
+  Array() = default;
+  Array(std::initializer_list<Value> values_) : values(values_) {}
+
   std::vector<Value> values;
 };
 

Reply via email to