fix clean up of move copy constructor

Move ampersand to the left to match the codebase
This commit is contained in:
kartikdutt18
2020-04-24 20:25:54 +05:30
parent 07cf3c5cd8
commit 74f662e1f0
2 changed files with 2 additions and 16 deletions
-14
View File
@@ -109,9 +109,6 @@ LARS::LARS(LARS&& other) :
{
// Clean the other object to prevent to objects pointing
// at the memory location.
if (other.matGram)
delete other.matGram;
other.matGram = new arma::mat(other.matGramInternal);
other.lambda1 = 0.0;
other.lambda2 = 0.0;
@@ -123,10 +120,6 @@ LARS& LARS::operator=(const LARS& other)
if (&other == this)
return *this;
// Clean the memory first.
if (matGram)
delete matGram;
matGramInternal = other.matGramInternal;
matGram = &matGramInternal;
matUtriCholFactor = other.matUtriCholFactor;
@@ -151,10 +144,6 @@ LARS& LARS::operator=(LARS&& other)
if (&other == this)
return *this;
// Clean the memory first.
if (matGram)
delete matGram;
matGramInternal = std::move(other.matGramInternal);
matGram = other.matGram;
matUtriCholFactor = std::move(other.matUtriCholFactor);
@@ -173,9 +162,6 @@ LARS& LARS::operator=(LARS&& other)
// Clean the other object to prevent to objects pointing
// at the memory location.
if (other.matGram)
delete other.matGram;
other.matGram = new arma::mat(other.matGramInternal);
other.lambda1 = 0.0;
other.lambda2 = 0.0;
+2 -2
View File
@@ -189,14 +189,14 @@ class LARS
*
* @param other LARS object to copy.
*/
LARS &operator=(const LARS& other);
LARS& operator=(const LARS& other);
/**
* Take ownership of the given LARS object.
*
* @param other LARS object to take ownership of.
*/
LARS &operator=(LARS&& other);
LARS& operator=(LARS&& other);
/**
* Run LARS. The input matrix (like all mlpack matrices) should be