# std::filesystem::swap(std::filesystem::path)

> C++ Atlas: `cppatlas.com/w/cpp/filesystem/path/swap2` | Source: https://en.cppreference.com/w/cpp/filesystem/path/swap2 | Domain: Filesystem | Standards: C++17

Exchanges the state of lhs with that of rhs. Effectively calls lhs.swap(rhs).

## Official Specification Summary (cppreference)

```cpp
// Defined in header <filesystem>
void swap( std::filesystem::path& lhs, std::filesystem::path& rhs ) noexcept; // (since C++17)
```

Exchanges the state of `lhs` with that of `rhs`. Effectively calls `lhs.swap(rhs)`.

### Parameters

- `lhs, rhs` - paths whose states to swap

### Return value

(none)

### See also

- [`swap`](https://en.cppreference.com/w/cpp/filesystem/path/swap): swaps two paths (public member function)

---
Attribution: content from https://en.cppreference.com/w/cpp/filesystem/path/swap2 (cppreference.com), licensed under CC-BY-SA 3.0 and GFDL. Modified: converted to markdown, study notes added. Offline snapshot of 9 February 2025.