这是cppcheck show waring的代码"[event.cpp:20] :(性能)函数参数'path'应该通过引用传递."
void
event::set_path(const std::string path)
{
this->_path = path;
}
Run Code Online (Sandbox Code Playgroud)
但其他代码包括字符串paramer不显示此警告,如:
int
watcher::init_watch(const struct stat *sb, std::string path, bool linked)
{
int wd;
....
}
Run Code Online (Sandbox Code Playgroud)
为什么?