# std::experimental::filesystem::operator/(std::experimental::filesystem::path)

> C++ Atlas: `cppatlas.com/w/cpp/experimental/fs/path/operator_slash` | Source: https://en.cppreference.com/w/cpp/experimental/fs/path/operator_slash | Domain: Technical specifications

Concatenates two paths. Effectively returns path(lhs) /= rhs.

## Official Specification Summary (cppreference)

```cpp
// Defined in header <experimental/filesystem>
path operator/( const path& lhs, const path& rhs ); // (filesystem TS)
```

Concatenates two paths. Effectively returns `path(lhs) /= rhs`.

### Parameters

- `lhs, rhs` - paths to concatenate

### Return value

The result of path concatenation.

### Exceptions

`noexcept` specification:

`noexcept`

### Example

```cpp
#include <experimental/filesystem>
#include <iostream>
namespace fs = std::experimental::filesystem;

int main()
{
    fs::path p1 = "C:Users";
    std::cout << "\"C:\" / \"Users\" == " << p1 << '\n';
    fs::path p2 = "batman";
    fs::path p3 = p1 / p2; // inserts fs::path::preferred_separator, '\' on Windows
    std::cout << "\"C:\" / \"Users\" / \"batman\" == " << p3 << '\n';
}
```

Output:

```text
"C:" / "Users" == "C:Users"
"C:" / "Users" / "batman" == "C:Users\batman"
```

### See also

- [`append`](https://en.cppreference.com/w/cpp/experimental/fs/path/append), [`operator/=`](https://en.cppreference.com/w/cpp/experimental/fs/path/append): appends elements to the path (public member function)

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