fix clean up of move copy constructor
Move ampersand to the left to match the codebase
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user