Skip to content

Commit

Permalink
Makes use of std::move to avoid another copy
Browse files Browse the repository at this point in the history
  • Loading branch information
louis-langholtz committed Jan 7, 2024
1 parent 785f3ef commit b7ca22a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Library/include/playrho/InvalidArgument.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

#include <stdexcept>
#include <string>
#include <utility> // for std::move

namespace playrho {

Expand All @@ -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.
};
Expand Down

0 comments on commit b7ca22a

Please sign in to comment.