--- trunk/src/math/Polynomial.hpp 2006/02/02 17:14:15 883 +++ trunk/src/math/Polynomial.hpp 2008/03/07 19:37:14 1230 @@ -53,7 +53,7 @@ #include #include #include - +#include "config.h" namespace oopse { template ElemType pow(ElemType x, int N) { @@ -187,6 +187,22 @@ namespace oopse { size_t size() { return polyPairMap_.size(); + } + + PolynomialType& operator = (const PolynomialType& p) { + + if (this != &p) // protect against invalid self-assignment + { + typename Polynomial::const_iterator i; + + polyPairMap_.clear(); // clear out the old map + + for (i = p.begin(); i != p.end(); ++i) { + this->setCoefficient(i->first, i->second); + } + } + // by convention, always return *this + return *this; } PolynomialType& operator += (const PolynomialType& p) { @@ -335,7 +351,7 @@ namespace oopse { return true; } - typedef Polynomial DoublePolynomial; + typedef Polynomial DoublePolynomial; } //end namespace oopse #endif //MATH_POLYNOMIAL_HPP