| 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
#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';
}"C:" / "Users" == "C:Users"
"C:" / "Users" / "batman" == "C:Users\batman"See also
| appends elements to the path (public member function) |
Content from this page on cppreference.com, licensed under CC-BY-SA 3.0 and GFDL. Modified: restyled, site navigation removed, code windows added. Offline snapshot of 9 February 2025.