Movatterモバイル変換


[0]ホーム

URL:


cppreference.com
Namespaces
Variants
    Actions

      std::experimental::filesystem::path::operator=

      From cppreference.com
      <cpp‎ |experimental‎ |fs‎ |path
       
       
       
      Filesystem library
      Classes
      Functions
      File types
       
      path
      Member functions
      Path decomposition
      Non-member functions
       
      path& operator=(const path& p);
      (1)(filesystem TS)
      path& operator=( path&& p);
      (2)(filesystem TS)
      template<class Source>
      path& operator=(const Source& source);
      (3)(filesystem TS)
      1) Replaces the contents of*this with a copy of the contents ofp.
      2) Replaces the contents of*this withp, possibly using move semantics:p is left in valid, but unspecified state.
      3) Replaces the contents of*this with a new path value constructed fromsource as if by overload(4) of thepath constructor. Equivalent toassign(source).

      Contents

      [edit]Parameters

      p - a path to assign
      source - astd::basic_string, 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 ofchar,char16_t,char32_t,wchar_t

      [edit]Return value

      *this

      [edit]Exceptions

      1) (none)
      2)
      noexcept specification:  
      noexcept
        
      3) (none)

      [edit]Example

      Run this code
      #include <experimental/filesystem>namespace fs= std::experimental::filesystem; int main(){    fs::path p="C:/users/abcdef/AppData/Local";    p= p/"Temp";// move assignmentconstwchar_t* wstr= L"D:/猫.txt";    p= wstr;// assignment from a source}

      [edit]See also

      assigns contents
      (public member function)[edit]
      constructs apath
      (public member function)[edit]
      Retrieved from "https://en.cppreference.com/mwiki/index.php?title=cpp/experimental/fs/path/operator%3D&oldid=169733"

      [8]ページ先頭

      ©2009-2026 Movatter.jp