From 34b8bb5d654794b8ab615041f8897d31a9e7637b Mon Sep 17 00:00:00 2001 From: SirLynix Date: Mon, 15 May 2023 08:31:42 +0200 Subject: [PATCH] Core/Resource: Pass filePath by value and move to prevent useless copy --- include/Nazara/Core/Resource.hpp | 2 +- src/Nazara/Core/Resource.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/Nazara/Core/Resource.hpp b/include/Nazara/Core/Resource.hpp index 0243a0441..075b052a3 100644 --- a/include/Nazara/Core/Resource.hpp +++ b/include/Nazara/Core/Resource.hpp @@ -23,7 +23,7 @@ namespace Nz const std::filesystem::path& GetFilePath() const; - void SetFilePath(const std::filesystem::path& filePath); + void SetFilePath(std::filesystem::path filePath); Resource& operator=(const Resource&) = default; Resource& operator=(Resource&&) noexcept = default; diff --git a/src/Nazara/Core/Resource.cpp b/src/Nazara/Core/Resource.cpp index c2bcf7873..33d850d75 100644 --- a/src/Nazara/Core/Resource.cpp +++ b/src/Nazara/Core/Resource.cpp @@ -31,8 +31,8 @@ namespace Nz * \param filePath Path to the resource */ - void Resource::SetFilePath(const std::filesystem::path& filePath) + void Resource::SetFilePath(std::filesystem::path filePath) { - m_filePath = filePath; + m_filePath = std::move(filePath); } }