Fix error "returning reference to temporary" (#302)
authorSergey Vostokov/AI Tools Lab/Staff Engineer/삼성전자 <s.vostokov@samsung.com>
Tue, 5 Jun 2018 08:39:38 +0000 (11:39 +0300)
committerGitHub Enterprise <noreply-CODE@samsung.com>
Tue, 5 Jun 2018 08:39:38 +0000 (11:39 +0300)
This commit fixes issue when member function returns
reference to the local variable.

Signed-off-by: Sergey Vostokov <s.vostokov@samsung.com>
contrib/nnc/include/module/plugin/shared_library.h
contrib/nnc/src/module/plugin/shared_library.cpp

index 24e9029..b56a404 100644 (file)
@@ -18,7 +18,7 @@ public:
   explicit SharedLibrary(const std::string &fullPath);
 
   void *findFunc(const std::string &funcName);
-  std::string getPath() const;
+  const std::string& getPath() const;
 
 
 private:
index b3a8cf8..6a67603 100644 (file)
@@ -58,7 +58,7 @@ bool SharedLibrary::loadLibrary()
   return (nullptr != _handle);
 }
 
-std::string SharedLibrary::getPath() const { return _path; }
+const std::string& SharedLibrary::getPath() const { return _path; }
 
 std::ostream &operator<<(std::ostream &st, const SharedLibrary &lib)
 {