std::experimental::filesystem::operator/(std::experimental::filesystem::path)
来自 cppreference.com
< cpp | experimental | fs | path
定义在头文件 <experimental/filesystem> 中 |
||
path operator/( const path& lhs, const path& rhs ); |
(filesystem TS) | |
连接两个路径。实际上返回 path(lhs) /= rhs.
内容 |
[编辑] 参数
lhs, rhs | - | 要连接的路径 |
[编辑] 返回值
路径连接的结果。
[编辑] 异常
noexcept 规范:
noexcept
[编辑] 示例
运行此代码
#include <experimental/filesystem> #include <iostream> namespace fs = std::experimental::filesystem; int main() { fs::path p1 = "C:Users"; std::cout << "\"C:\" / \"Users\" == " << p1 << '\n'; fs::path p2 = "batman"; fs::path p3 = p1 / p2; // inserts fs::path::preferred_separator, '\' on Windows std::cout << "\"C:\" / \"Users\" / \"batman\" == " << p3 << '\n'; }
输出
"C:" / "Users" == "C:Users" "C:" / "Users" / "batman" == "C:Users\batman"
[编辑] 参见
将元素追加到路径 (公有成员函数) |