From b7ca22af899bc0fccf94b16f3e941917f27ebbc0 Mon Sep 17 00:00:00 2001 From: Louis Langholtz Date: Sun, 7 Jan 2024 15:29:57 -0700 Subject: [PATCH] Makes use of std::move to avoid another copy --- Library/include/playrho/InvalidArgument.hpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Library/include/playrho/InvalidArgument.hpp b/Library/include/playrho/InvalidArgument.hpp index bf625c678..4f8a89dd3 100644 --- a/Library/include/playrho/InvalidArgument.hpp +++ b/Library/include/playrho/InvalidArgument.hpp @@ -26,6 +26,7 @@ #include #include +#include // for std::move namespace playrho { @@ -49,10 +50,10 @@ struct WasDestroyed: public InvalidArgument using type = T; ///< Type of the argument that was destroyed. /// @brief Initializing constructor. - WasDestroyed(type v, const std::string& msg): InvalidArgument{msg}, value{v} {} + WasDestroyed(type v, const std::string& msg): InvalidArgument{msg}, value{std::move(v)} {} /// @brief Initializing constructor. - WasDestroyed(type v, const char* msg): InvalidArgument{msg}, value{v} {} + WasDestroyed(type v, const char* msg): InvalidArgument{msg}, value{std::move(v)} {} type value{}; ///< Value of the type that was destroyed. };