std::experi...::operator=(3)

πŸ“¦ version 2024.07.05, in nixpkgs unstable, opensuse-leap 16.0

πŸ’– std::experi...::operator=(3) πŸ’–

okay so this is the std::experi...::operator=(3) page from the C++ Standard Libary manual, and it's literally all about the assignment operator for std::experimental::filesystem::path. bestie, it's giving overload central and we're gonna get through every single one together 🫢

🌸 NAME 🌸

std::experimental::filesystem::path::operator= β€” std::experimental::filesystem::path::operator=

✨ Synopsis ✨

path& operator=( const path& p );        (1) (filesystem TS)
path& operator=( path&& p );             (2) (filesystem TS)
template< class Source >                 (3) (filesystem TS)
path& operator=( const Source& source );
  1. Replaces the contents of *this with a copy of the contents of p.
  2. Replaces the contents of *this with p, possibly using move semantics: p is left in a valid, but unspecified state 😭
  3. Replaces the contents of *this with a new path value constructed from source as if by overload (4) of the path constructor. Equivalent to assign(source).

πŸŽ€ Parameters πŸŽ€

  • p β€” a path to assign
    • a std::basic_string, pointer to a null-terminated character/wide character
  • source β€” 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

πŸ’– Return value πŸ’–

  • *this

πŸ’… Exceptions πŸ’…

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

πŸ¦‹ 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 assignment
    const wchar_t* wstr = L"D:/猫.txt";
    p = wstr; // assignment from a source
}

🌈 See also 🌈

  • assign β€” assigns contents (public member function)
  • constructor β€” constructs a path (public member function)

πŸ‘‘ Categories πŸ‘‘

  • Noindexed pages
  • unconditionally noexcept

🧚 Hidden categories 🧚

  • Pages with unreviewed unconditional noexcept template
  • Pages with unreviewed noexcept template

okay bye bestie πŸ’– source: http://cppreference.com, version/date: 2024.06.10, page: std::experi...::operator=(3). periodt ✨

πŸ“¦ where this page comes from