From: Mikko Rasa Date: Sat, 25 May 2013 23:14:45 +0000 (+0300) Subject: Negation contains a pointer and needs copy c'tor and operator= X-Git-Url: http://git.tdb.fi/?p=libs%2Fmath.git;a=commitdiff_plain;h=54f265afb8a9f27a05a287116379e6f829560e6c Negation contains a pointer and needs copy c'tor and operator= --- diff --git a/source/geometry/negation.h b/source/geometry/negation.h index c01763d..ce2f787 100644 --- a/source/geometry/negation.h +++ b/source/geometry/negation.h @@ -18,6 +18,9 @@ private: public: Negation(const Shape &); + Negation(const Negation &); + Negation &operator=(const Negation &); + ~Negation(); virtual Negation *clone() const; @@ -34,6 +37,25 @@ inline Negation::Negation(const Shape &s): shape(s.clone()) { } +template +inline Negation::Negation(const Negation &other): + shape(other.shape->clone()) +{ } + +template +inline Negation &Negation::operator=(const Negation &other) +{ + delete shape; + shape = other.shape->clone(); + return *this; +} + +template +inline Negation::~Negation() +{ + delete shape; +} + template inline Negation *Negation::clone() const {