assignment operator added
This commit is contained in:
parent
26bb2de050
commit
d43ef479b6
@ -27,14 +27,27 @@ public:
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Custom copy constructor which prevents setting the
|
* @brief Custom copy constructor which prevents setting the
|
||||||
* underlying pointer wrong.
|
* underlying pointer wrong. This function allocates memory!
|
||||||
|
* @details This is a very heavy operation so try to avoid this!
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
DynamicFIFO(const DynamicFIFO& other): FIFOBase<T>(other),
|
DynamicFIFO(const DynamicFIFO& other): FIFOBase<T>(other),
|
||||||
fifoVector(other.maxCapacity) {
|
fifoVector(other.maxCapacity) {
|
||||||
|
this->fifoVector = other.fifoVector;
|
||||||
this->setContainer(fifoVector.data());
|
this->setContainer(fifoVector.data());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Custom assignment operator
|
||||||
|
* @details This is a very heavy operation so try to avoid this!
|
||||||
|
* @param other DyamicFIFO to copy from
|
||||||
|
*/
|
||||||
|
DynamicFIFO& operator=(const DynamicFIFO& other){
|
||||||
|
FIFOBase<T>::operator=(other);
|
||||||
|
this->fifoVector = other.fifoVector;
|
||||||
|
this->setContainer(fifoVector.data());
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
private:
|
private:
|
||||||
std::vector<T> fifoVector;
|
std::vector<T> fifoVector;
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user