std::experimental::filesystem:: operator/ (std::experimental::filesystem::path)
From cppreference.net
<
cpp
|
experimental
|
fs
|
path
C++
Experimental
| Technical Specification | ||||
| Filesystem library (filesystem TS) | ||||
| Library fundamentals (library fundamentals TS) | ||||
| Library fundamentals 2 (library fundamentals TS v2) | ||||
| Library fundamentals 3 (library fundamentals TS v3) | ||||
| Extensions for parallelism (parallelism TS) | ||||
| Extensions for parallelism 2 (parallelism TS v2) | ||||
| Extensions for concurrency (concurrency TS) | ||||
| Extensions for concurrency 2 (concurrency TS v2) | ||||
| Concepts (concepts TS) | ||||
| Ranges (ranges TS) | ||||
| Reflection (reflection TS) | ||||
| Mathematical special functions (special functions TR) | ||||
| Experimental Non-TS | ||||
| Pattern Matching | ||||
| Linear Algebra | ||||
| std::execution | ||||
| Contracts | ||||
| 2D Graphics |
Filesystem library
| Classes | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Functions | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| File types | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
path
| Member functions | ||||
| Path decomposition | ||||
| Non-member functions | ||||
|
operator/
|
||||
|
定义于头文件
<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; // 插入 fs::path::preferred_separator,Windows 系统上为 '\' std::cout << "\"C:\" / \"Users\" / \"batman\" == " << p3 << '\n'; }
输出:
"C:" / "Users" == "C:Users" "C:" / "Users" / "batman" == "C:Users\batman"
参见
|
向路径追加元素
(公开成员函数) |