How do I concat to c++ path without mutating?

Viewed 173

I thought I'd found the right function: std::filesystem::path::concat to do something like

auto b = path(C:a/b); 
const auto c = b.concat(/c);

c has the right value, but b is mutated (it ultimately equals c).

I want b to remain unaffected. According to the documentation, concat is equivalent to operator+=. However, there's no operator+.

I think is a weird design, because there's the similar operator/= and operator/ where / means subdirectory instead of literal concat (like +=).

Can I do this non-mutating concat without something like const auto c = std::filesystem::path(b.string() + "/c")?

0 Answers
Related