Skip to content

Commit

Permalink
Mark places where we might be able to benefit from move semantics
Browse files Browse the repository at this point in the history
Useful info for #131
  • Loading branch information
saxbophone committed Feb 17, 2023
1 parent 1851caf commit 2ddbcf6
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions arby/include/arby/Nat.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,7 @@ namespace com::saxbophone::arby {
constexpr Nat& operator*=(const Nat& rhs) {
Nat product = *this * rhs; // uses friend *operator
// assign product's digits back to our digits
_digits = product._digits;
_digits = product._digits; // TODO: std::move() ?
return *this; // return the result by reference
}
/**
Expand Down Expand Up @@ -680,7 +680,7 @@ namespace com::saxbophone::arby {
constexpr Nat& operator/=(const Nat& rhs) {
Nat quotient = *this / rhs; // uses friend /operator
// assign quotient's digits back to our digits
_digits = quotient._digits;
_digits = quotient._digits; // TODO: std::move() ?
return *this; // return the result by reference
}
/**
Expand All @@ -707,7 +707,7 @@ namespace com::saxbophone::arby {
constexpr Nat& operator%=(const Nat& rhs) {
Nat remainder = *this % rhs; // uses friend %operator
// assign remainder's digits back to our digits
_digits = remainder._digits;
_digits = remainder._digits; // TODO: std::move() ?
return *this; // return the result by reference
}
/**
Expand Down Expand Up @@ -802,7 +802,7 @@ namespace com::saxbophone::arby {
constexpr Nat& operator^=(const Nat& rhs) {
Nat result = *this ^ rhs; // reuse friend function
// re-assign digits to this
_digits = result._digits;
_digits = result._digits; // TODO: std::move() ?
return *this;
}
/**
Expand Down

0 comments on commit 2ddbcf6

Please sign in to comment.