名稱空間
變體
操作

std::filesystem::path::assign

來自 cppreference.com
< cpp‎ | filesystem‎ | path
 
 
 
 
path& assign( string_type&& source );
(1) (C++17 起)
template< class Source >
path& assign( const Source& source );
(2) (C++17 起)
template< class InputIt >
path& assign( InputIt first, InputIt last );
(3) (C++17 起)

以從給定字元序列構造的新路徑名替換 path 物件的內容。

1) 賦值以檢測到格式的字串 source 所標識的路徑名,此後 source 會處於合法但未指定的狀態。
2) 賦值以檢測到格式的字元範圍 source 所標識的路徑名。
3) 賦值以檢測到格式的字元範圍 [first, last) 所標識的路徑名。

(2) 僅若 Sourcepath 不是同一型別,且滿足下列任一條件時才參與過載決議:

目錄

[編輯] 引數

source - - 要使用的字元範圍,表示為 std::stringstd::string_view、指向空終止多位元組字串的指標,或作為 value_type 為字元型別的輸入迭代器,指向一個空終止多位元組字串
first, last - - 要使用的字元範圍
型別要求
-
InputIt 必須滿足 LegacyInputIterator 的要求。
-
InputIt 的 value_type 必須是編碼字元型別之一(charwchar_tchar16_tchar32_t

[編輯] 返回值

*this

[編輯] 缺陷報告

下列更改行為的缺陷報告追溯地應用於以前出版的 C++ 標準。

缺陷報告 應用於 釋出時的行為 正確的行為
LWG 3244 C++17 缺少 Source 不能是 path 的約束 已新增

[編輯] 參閱

賦值另一個路徑
(公開成員函式) [編輯]