[mlpack-git] master: Remove un-necessary string copy for GetTimer() (3c32013)

gitdub at big.cc.gt.atl.ga.us gitdub at big.cc.gt.atl.ga.us
Sat Mar 14 16:44:32 EDT 2015


Repository : https://github.com/mlpack/mlpack

On branch  : master
Link       : https://github.com/mlpack/mlpack/compare/70342dd8e5c17e0c164cfb8189748671e9c0dd44...3c32013479e1cd34425925c835c1011a6e8b7f76

>---------------------------------------------------------------

commit 3c32013479e1cd34425925c835c1011a6e8b7f76
Author: Stephen Tu <tu.stephenl at gmail.com>
Date:   Sat Mar 14 13:44:04 2015 -0700

    Remove un-necessary string copy for GetTimer()


>---------------------------------------------------------------

3c32013479e1cd34425925c835c1011a6e8b7f76
 src/mlpack/core/util/timers.cpp | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/mlpack/core/util/timers.cpp b/src/mlpack/core/util/timers.cpp
index b722f1e..0dbd7d5 100644
--- a/src/mlpack/core/util/timers.cpp
+++ b/src/mlpack/core/util/timers.cpp
@@ -59,8 +59,7 @@ std::map<std::string, timeval>& Timers::GetAllTimers()
 
 timeval Timers::GetTimer(const std::string& timerName)
 {
-  std::string name(timerName);
-  return timers[name];
+  return timers[timerName];
 }
 
 void Timers::PrintTimer(const std::string& timerName)



More information about the mlpack-git mailing list