diff options
author | MarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz> | 2023-10-26 13:24:47 +0200 |
---|---|---|
committer | MarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz> | 2023-12-11 17:41:54 +0100 |
commit | fa2bac08c22182e738a8cabf1b24a9dbf3b092d2 (patch) | |
tree | 722a82ff59c8ef23e62f2841347b19d22e457036 /src/util | |
parent | faea30227ba633da5ab257d0247853e0927244bb (diff) |
refactor: Avoid copy/move in fs.h
The operator accepts a const& reference, so no copy or move is needed.
See https://en.cppreference.com/w/cpp/filesystem/path/append
Diffstat (limited to 'src/util')
-rw-r--r-- | src/util/fs.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/util/fs.h b/src/util/fs.h index 7e2803b6aa..f71869f349 100644 --- a/src/util/fs.h +++ b/src/util/fs.h @@ -35,7 +35,7 @@ public: // Allow path objects arguments for compatibility. path(std::filesystem::path path) : std::filesystem::path::path(std::move(path)) {} path& operator=(std::filesystem::path path) { std::filesystem::path::operator=(std::move(path)); return *this; } - path& operator/=(std::filesystem::path path) { std::filesystem::path::operator/=(path); return *this; } + path& operator/=(const std::filesystem::path& path) { std::filesystem::path::operator/=(path); return *this; } // Allow literal string arguments, which are safe as long as the literals are ASCII. path(const char* c) : std::filesystem::path(c) {} @@ -97,9 +97,9 @@ static inline auto quoted(const std::string& s) } // Allow safe path append operations. -static inline path operator/(path p1, path p2) +static inline path operator/(path p1, const path& p2) { - p1 /= std::move(p2); + p1 /= p2; return p1; } static inline path operator/(path p1, const char* p2) |