From: Sergey Vostokov/AI Tools Lab/Staff Engineer/삼성전자 Date: Tue, 5 Jun 2018 08:39:38 +0000 (+0300) Subject: Fix error "returning reference to temporary" (#302) X-Git-Tag: nncc_backup~2621 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=874957b069a42deeca17155720a4bce19242f65e;p=platform%2Fcore%2Fml%2Fnnfw.git Fix error "returning reference to temporary" (#302) This commit fixes issue when member function returns reference to the local variable. Signed-off-by: Sergey Vostokov --- diff --git a/contrib/nnc/include/module/plugin/shared_library.h b/contrib/nnc/include/module/plugin/shared_library.h index 24e9029..b56a404 100644 --- a/contrib/nnc/include/module/plugin/shared_library.h +++ b/contrib/nnc/include/module/plugin/shared_library.h @@ -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: diff --git a/contrib/nnc/src/module/plugin/shared_library.cpp b/contrib/nnc/src/module/plugin/shared_library.cpp index b3a8cf8..6a67603 100644 --- a/contrib/nnc/src/module/plugin/shared_library.cpp +++ b/contrib/nnc/src/module/plugin/shared_library.cpp @@ -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) {