It is possible to append multiple paths in a row using the / operator:
std::filesystem::path p1{"A"}; auto p2 = p1 / "B" / "C"; which is rather convenient. However, concat only offers +=:
std::filesystem::path p1{"A"}; auto p2 = p1 / "B" / "C" + ".d"; // NOT OK This is pretty annoying, as I can't easily add extensions to the end of my paths. I have no choice but to write something like
std::filesystem::path p1{"A"}; auto p2 = p1 / "B" / "C"; p2 += ".d"; Am I missing something? Is there a reason for this inconsistency?
https://stackoverflow.com/questions/65917812/no-operator-for-stdfilesystempath January 27, 2021 at 07:03PM
没有评论:
发表评论