path& operator=( const path& p ); | (1) | (since C++17) |
path& operator=( path&& p ) noexcept; | (2) | (since C++17) |
path& operator=( string_type&& source ); | (3) | (since C++17) |
template< class Source > path& operator=( const Source& source ); | (4) | (since C++17) |
*this
with a pathname whose both native and generic format representations equal those of p
.*this
with a pathname whose both native and generic format representations equal those of p
, possibly using move semantics: p
is left in a valid, but unspecified state.*this
with a new path value constructed from detected-format source
, which is left in valid, but unspecified state. Equivalent to assign(std::move(source))
.*this
with a new path value constructed from detected-format source
as if by overload (4) of the path constructor. Equivalent to assign(source)
.p | - | a path to assign |
source | - | a std::basic_string , std::basic_string_view , pointer to a null-terminated character/wide character string, or an input iterator that points to a null-terminated character/wide character sequence. The character type must be one of char , char16_t , char32_t , wchar_t |
*this
.
#include <filesystem> namespace fs = std::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 }
assigns contents (public member function) |
|
constructs a path (public member function) |
© cppreference.com
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
http://en.cppreference.com/w/cpp/filesystem/path/operator=