如何在不改变的情况下连接到 C++ 路径?

Tob*_*emi 6 c++ filesystems std

我以为我找到了正确的功能:std::filesystem::path::concat做类似的事情

auto b = path(C:a/b); 
const auto c = b.concat(/c);
Run Code Online (Sandbox Code Playgroud)

c具有正确的值,但b发生了变异(最终等于c)。

我想b保持不受影响。根据文档,concat相当于operator+=. 然而,没有operator+

我认为这是一个奇怪的设计,因为有类似的operator/=operator/where/意味着子目录而不是字面 concat (如+=)。

我可以在没有类似的东西的情况下进行这种非变异连接吗const auto c = std::filesystem::path(b.string() + "/c")