std::experimental::filesystem::path::operator=
來自 cppreference.com
< cpp | experimental | fs | path
path& operator=( const path& p ); |
(1) | (檔案系統 TS) |
path& operator=( path&& p ); |
(2) | (檔案系統 TS) |
template< class Source > path& operator=( const Source& source ); |
(3) | (檔案系統 TS) |
1) 用 p 的內容副本替換 *this 的內容。
2) 用 p 替換 *this 的內容,可能使用移動語義:p 處於有效但未指定的狀態。
目錄 |
[編輯] 引數
p | - | 要賦值的路徑 |
source | - | 一個 std::basic_string、指向空終止字元/寬字元字串的指標,或指向空終止字元/寬字元序列的輸入迭代器。字元型別必須是 char、char16_t、char32_t、wchar_t 之一 |
[編輯] 返回值
*this
[編輯] 異常
1) (無)
2)
noexcept 規範:
不丟擲異常
3) (無)
[編輯] 示例
執行此程式碼
#include <experimental/filesystem> namespace fs = std::experimental::filesystem; int main() { fs::path p = "C:/users/abcdef/AppData/Local"; p = p / "Temp"; // move assignment const wchar_t* wstr = L"D:/貓.txt"; p = wstr; // assignment from a source }
[編輯] 參見
賦值內容 (公共成員函式) | |
構造一個 path (公共成員函式) |