std::experimental::filesystem::path:: concat, std::experimental::filesystem::path:: operator+=
From cppreference.net
<
cpp
|
experimental
|
fs
|
path
|
path
&
operator
+
=
(
const
path
&
p
)
;
|
(1) | (文件系统 TS) |
|
path
&
operator
+
=
(
const
string_type
&
str
)
;
|
(2) | (文件系统 TS) |
|
path
&
operator
+
=
(
const
value_type
*
ptr
)
;
|
(3) | (文件系统 TS) |
|
path
&
operator
+
=
(
value_type x
)
;
|
(4) | (文件系统 TS) |
|
template
<
class
Source
>
path & operator + = ( const Source & source ) ; |
(5) | (文件系统 TS) |
|
template
<
class
CharT
>
path & operator + = ( CharT x ) ; |
(6) | (文件系统 TS) |
|
template
<
class
Source
>
path & concat ( const Source & source ) ; |
(7) | (文件系统 TS) |
|
template
<
class
InputIt
>
path & concat ( InputIterator first, InputIterator last ) ; |
(8) | (文件系统 TS) |
将当前路径与参数进行拼接。
5)
与
(1)
相同,区别在于生成的
native()
是原始
native()
与由
source
所表示的序列(可以是可移植格式或原生格式)的拼接,该序列可以是
std::
basic_string
、以空字符结尾的多字符字符串,或指向以空字符结尾的多字符序列的输入迭代器。
6)
与
(4)
相同,但可能会执行字符转换。
7)
同
(5)
。
8)
与
(5)
相同,不同之处在于该序列由任何指定多字符字符串的迭代器对表示。
目录 |
参数
| p | - | 要追加的路径 |
| str | - | 要追加的字符串 |
| ptr | - | 指向要追加的空终止字符串起始位置的指针 |
| x | - | 要追加的单个字符 |
| source | - | std:: basic_string 、空终止多字符字符串,或指向空终止多字符序列的输入迭代器,用于表示路径名(可移植格式或原生格式) |
| first, last | - | 指定表示路径名的多字符序列的 LegacyInputIterator s 迭代器对 |
| 类型要求 | ||
-
InputIt
必须满足
LegacyInputIterator
的要求。
|
||
-
InputIt
的值类型必须是已编码字符类型(
char
、
wchar_t
、
char16_t
和
char32_t
)。
|
||
-
CharT
必须是已编码字符类型(
char
、
wchar_t
、
char16_t
和
char32_t
)。
|
||
返回值
* this
异常
若底层操作系统API出错可能抛出 filesystem_error ,若内存分配失败则可能抛出 std:: bad_alloc 。
注释
与 append() 或 operator/= 不同,此处永远不会引入额外的目录分隔符。
示例
运行此代码
输出:
"" + "var" == "var" "" + "var" + "lib" == "varlib"
参见
|
向路径追加元素
(公开成员函数) |
|
|
用目录分隔符连接两个路径
(函数) |