##### cppreference.com

##### Search

Create account

##### Namespaces

- Page
- Discussion

##### Variants

##### Views

- View
- Edit
- History

##### Actions

# std::filesystem::path::assign

From cppreference.com
< cpp‎ | filesystem‎ | path

template< class Source > path& assign( const Source& source ); | (1) | (since C++17)
template< class InputIt > path& assign( InputIt first, InputIt last ); | (2) | (since C++17)

Replaces the contents to the `path` object by a new pathname constructed from the given character sequence.

1) Assigns the pathname identified by the character range `source`.
2) Assigns the pathname identified by character range `[first, last)`.

### [edit] Parameters

source | - | a character range to use, represented as std::string, std::string_view, pointer to a null-terminated multibyte string, or as an input iterator with char value type that points to a null-terminated multibyte string
first, last | - | a character range to use
Type requirements
- `InputIt` must meet the requirements of `InputIterator`.
- The value type of `InputIt` must be one of the encoded character types (char, wchar_t, char16_t and char32_t)

|}

### [edit] Return value

*this

### [edit] Exceptions

| This section is incomplete

### [edit] See also

operator= | assigns another path (public member function) [edit]

Retrieved from "http://en.cppreference.com/mwiki/index.php?title=cpp/filesystem/path/assign&oldid=86313"
Category:

- Todo without reason