You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by ne...@apache.org on 2017/04/10 20:04:38 UTC

[2/2] mesos git commit: Avoided excessive copying in the default implementation of 'stringify'.

Avoided excessive copying in the default implementation of 'stringify'.

The default implementation of 'stringify' was always making needless
copies of its argument which can be expensive for larger types. This
patch changes the default overload of 'stringify' to always take its
argument by const reference.

This change requires changing 'stringify' for 'bool' arguments from a
'stringify' template specialization to an overload.

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


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

Branch: refs/heads/master
Commit: d5c5bb0ebfc1c5454d7b36c3a9dfc908e8f49eb7
Parents: 387ea0d
Author: Benjamin Bannier <be...@mesosphere.io>
Authored: Mon Apr 10 13:02:54 2017 -0700
Committer: Neil Conway <ne...@gmail.com>
Committed: Mon Apr 10 13:02:54 2017 -0700

----------------------------------------------------------------------
 3rdparty/stout/include/stout/stringify.hpp | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/d5c5bb0e/3rdparty/stout/include/stout/stringify.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/stout/include/stout/stringify.hpp b/3rdparty/stout/include/stout/stringify.hpp
index 508cdc7..44da506 100644
--- a/3rdparty/stout/include/stout/stringify.hpp
+++ b/3rdparty/stout/include/stout/stringify.hpp
@@ -33,7 +33,7 @@
 #include "set.hpp"
 
 template <typename T>
-std::string stringify(T t)
+std::string stringify(const T& t)
 {
   std::ostringstream out;
   out << t;
@@ -63,7 +63,6 @@ inline std::string stringify(const std::wstring& str)
 #endif // __WINDOWS__
 
 
-template <>
 inline std::string stringify(bool b)
 {
   return b ? "true" : "false";