我使用std::ptr_fun如下:
static inline std::string <rim(std::string &s) {
s.erase(s.begin(), std::find_if(s.begin(), s.end(), std::not1(std::ptr_fun<int, int>(std::isspace))));
return s;
}
Run Code Online (Sandbox Code Playgroud)
如本回答所示.
但是这不能用C++ 17编译(使用Microsoft Visual Studio 2017),错误如下:
error C2039: 'ptr_fun': is not a member of 'std'
Run Code Online (Sandbox Code Playgroud)
怎么解决这个问题?
我正在使用带有Xcode 9.0 beta的std :: experimental :: filesystem.编译器阶段完成正常,但链接器抱怨未定义的符号:
std::experimental::filesystem::v1::path::__filename() const
std::experimental::filesystem::v1::path::__filename() const
std::experimental::filesystem::v1::path::__stem() const
std::experimental::filesystem::v1::__status(std::experimental::filesystem::v1::path const&, std::__1::error_code*)
Run Code Online (Sandbox Code Playgroud)
我也在使用std :: experimental :: filesystem :: canonical(),但是链接器并没有抱怨丢失它.
如何配置项目以包含这些缺少的引用?
更新:
我一直在尝试一个更简单的程序.如果我只使用canonical(),那么链接器会抱怨它丢失了.
我可以使用std :: experimental :: optional - 一切都编译,链接并运行OK.但"可选"是一个模板,因此可能不涉及库.