diff --git a/eo/src/eoDualFitness.h b/eo/src/eoDualFitness.h index 0ab99413f..3fb9c0a37 100644 --- a/eo/src/eoDualFitness.h +++ b/eo/src/eoDualFitness.h @@ -104,14 +104,6 @@ public: return _is_feasible; } - //! Copy operator - eoDualFitness& operator=(const eoDualFitness& other) - { - _value = other._value; - _is_feasible = other._is_feasible; - return *this; - } - //! Copy operator from a std::pair eoDualFitness& operator=(const std::pair& v) { @@ -119,6 +111,18 @@ public: _is_feasible = v.second; return *this; } + + //! Copy operator from another eoDualFitness + template + eoDualFitness & operator=(const eoDualFitness& other ) + { + if (this != &other) { + this->_value = other._value; + this->_is_feasible = other._is_feasible; + } + return *this; + } + //! Comparison that separate feasible individuals from unfeasible ones. Feasible are always better /*! @@ -155,6 +159,7 @@ public: //! Greater or equal: if the other is not greater than me bool operator>=(const eoDualFitness& other ) const { return !(*this < other); } + public: //! Add a given fitness to the current one