std::experimental::filesystem::operator/(std::experimental::filesystem::path)
来自cppreference.com
< cpp | experimental | fs | path
在标头 <experimental/filesystem> 定义
|
||
path operator/( const path& lhs, const path& rhs ); |
(文件系统 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"
参阅
向路径追加元素 (公开成员函数) |