Skip to content
This repository has been archived by the owner on Apr 2, 2024. It is now read-only.

Commit

Permalink
Use perfect forwarding in vm_distance
Browse files Browse the repository at this point in the history
  • Loading branch information
vLKp committed Nov 11, 2023
1 parent c0bcbfc commit a6161c0
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions common/include/vecmat.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,19 +54,19 @@ class vm_distance
{
}
template <typename T>
vm_distance &operator+=(const T &rhs)
vm_distance &operator+=(T &&rhs)
{
return *this = (*this + rhs);
return *this = (*this + std::forward<T>(rhs));
}
template <typename T>
vm_distance &operator*=(const T &rhs)
vm_distance &operator*=(T &&rhs)
{
return *this = (*this * rhs);
return *this = (*this * std::forward<T>(rhs));
}
template <typename T>
vm_distance &operator/=(const T &rhs)
vm_distance &operator/=(T &&rhs)
{
return *this = (*this / rhs);
return *this = (*this / std::forward<T>(rhs));
}
[[nodiscard]]
constexpr vm_distance operator+(const vm_distance &rhs) const
Expand Down Expand Up @@ -159,9 +159,9 @@ class vm_distance_squared
return !(*this < rhs);
}
template <typename T>
vm_distance_squared &operator-=(const T &rhs)
vm_distance_squared &operator-=(T &&rhs)
{
return *this = (*this - rhs);
return *this = (*this - std::forward<T>(rhs));
}
constexpr vm_distance_squared operator-(const fix &) const = delete;
[[nodiscard]]
Expand Down

0 comments on commit a6161c0

Please sign in to comment.