小编use*_*478的帖子

std :: ptr_fun替换c ++ 17

我使用std::ptr_fun如下:

static inline std::string &ltrim(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)

怎么解决这个问题?

c++ c++17

18
推荐指数
3
解决办法
7319
查看次数

将std :: experimental :: filesystem与Xcode 9连接起来

我正在使用带有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.但"可选"是一个模板,因此可能不涉及库.

macos xcode c++17

6
推荐指数
1
解决办法
1146
查看次数

标签 统计

c++17 ×2

c++ ×1

macos ×1

xcode ×1