You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by ch...@apache.org on 2018/05/23 23:32:07 UTC

[3/6] mesos git commit: Overloaded `stringify` for `Error`s to reduce overheads.

Overloaded `stringify` for `Error`s to reduce overheads.

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


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

Branch: refs/heads/master
Commit: d7a1fe47e06944dcb50d93b697f8cfcf743bb1a5
Parents: 21305ab
Author: Chun-Hung Hsiao <ch...@mesosphere.io>
Authored: Thu May 17 12:25:12 2018 -0700
Committer: Chun-Hung Hsiao <ch...@mesosphere.io>
Committed: Wed May 23 16:31:12 2018 -0700

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


http://git-wip-us.apache.org/repos/asf/mesos/blob/d7a1fe47/3rdparty/stout/include/stout/stringify.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/stout/include/stout/stringify.hpp b/3rdparty/stout/include/stout/stringify.hpp
index 49bf684..ef7b26f 100644
--- a/3rdparty/stout/include/stout/stringify.hpp
+++ b/3rdparty/stout/include/stout/stringify.hpp
@@ -29,6 +29,7 @@
 #endif // __WINDOWS__
 
 #include "abort.hpp"
+#include "error.hpp"
 #include "hashmap.hpp"
 #include "set.hpp"
 
@@ -190,4 +191,14 @@ std::string stringify(const hashmap<K, V>& map)
   return out.str();
 }
 
+
+// TODO(chhsiao): This overload returns a non-const rvalue for consistency.
+// Consider the following overloads instead for better performance:
+//   const std::string& stringify(const Error&);
+//   std::string stringify(Error&&);
+inline std::string stringify(const Error& error)
+{
+  return error.message;
+}
+
 #endif // __STOUT_STRINGIFY_HPP__