std::move报错
Created by: jtyoui
template <class... ARGS>
std::string format_string(const char* fmt, ARGS&&... args) {
std::string str;
format_string_append(str, fmt, args...);
return std::move(str);
}
template <class... ARGS>
std::string format_string(const std::string& fmt, ARGS&&... args) {
return format_string(fmt.c_str(), args...);
:wq
54 | return std::move(str);
| ^
/opt/Paddle-1.8.3/paddle/fluid/string/string_helper.h:54:23: note: remove 'std::move' call
/opt/Paddle-1.8.3/paddle/fluid/string/string_helper.h: In instantiation of 'std::string paddle::string::format_string(const char*, ARGS&& ...) [with ARGS = {const char*}; std::string =
std::__cxx11::basic_string<char>]':
/opt/Paddle-1.8.3/paddle/fluid/framework/io/fs.cc:115:71: required from here
/opt/Paddle-1.8.3/paddle/fluid/string/string_helper.h:54:23: error: moving a local object in a return statement prevents copy elision [-Werror=pessimizing-move]
/opt/Paddle-1.8.3/paddle/fluid/string/string_helper.h:54:23: note: remove 'std::move' call
/opt/Paddle-1.8.3/paddle/fluid/string/string_helper.h: In instantiation of 'std::string paddle::string::format_string(const char*, ARGS&& ...) [with ARGS = {const char*, const char*, co
nst char*}; std::string = std::__cxx11::basic_string<char>]':
/opt/Paddle-1.8.3/paddle/fluid/framework/io/fs.cc:345:78: required from here
/opt/Paddle-1.8.3/paddle/fluid/string/string_helper.h:54:23: error: moving a local object in a return statement prevents copy elision [-Werror=pessimizing-move]
/opt/Paddle-1.8.3/paddle/fluid/string/string_helper.h:54:23: note: remove 'std::move' call
[ 5%] Built target data_feed_proto