C++ 为什么反转路径是非法的
C++ Why is it illegal to reverse a path?
#include <algorithm>
#include <filesystem>
int main()
{
std::experimental::filesystem::path str("fffff/aaaa/.");
std::reverse(str.begin(),str.end());
return 0;
}
我使用的是vs2015,上面的这段代码无法编译,但我仍然可以反转字符串。
#include <algorithm>
#include <filesystem>
int main()
{
std::string str("fffff/aaaa/.");
std::reverse(str.begin(),str.end());
return 0;
}
为什么?
这
不会编译为path::begin()
,path::end()
返回path::iterator
这是path::const_iterator
的别名。
请参阅 http://en.cppreference.com/w/cpp/experimental/fs/path
相关文章:
- 无法编译 rtmidi 测试 cmidiin.cpp 文件, 非法指令
- 如何将更多文件夹添加到c++include路径
- 带有特殊路径部分的"std::filesystem::weakly_canonical"失败
- C++A*算法并不总是在路径中具有目标节点
- 从函数角度看ID到文件路径的内部与外部映射
- boost xml parsingl将xml的路径作为变量发送
- 编写代码时C++出现错误:错误 1 错误 C2601:'circle':本地函数定义是非法的
- 对于MacOS上的G++,如何添加默认的include目录/usr/local/include和默认的库搜索路径/usr
- 如何使用cppcheck处理半相对包含路径
- 在C++中设置基于操作系统的文件路径
- 基于编译器选项的编译二进制路径
- 按边长度递归搜索图中所有可行路径
- 使用变量值作为 PlaySound 中的路径
- 如何转换真实路径 CString c++
- 从 GUID 获取 USB 卷路径
- 查找 GCD:并非所有控制路径都返回值
- C++17 文件系统::remove_all 带有通配符路径
- 在带有尾部斜杠的路径上返回 std::filesystem::create_directories() 的值
- 获取当前正在运行的 exe 名称(不是路径)
- C++ 为什么反转路径是非法的