]> git.tdb.fi Git - libs/math.git/commitdiff
Negation contains a pointer and needs copy c'tor and operator=
authorMikko Rasa <tdb@tdb.fi>
Sat, 25 May 2013 23:14:45 +0000 (02:14 +0300)
committerMikko Rasa <tdb@tdb.fi>
Sat, 25 May 2013 23:14:45 +0000 (02:14 +0300)
source/geometry/negation.h

index c01763d1c8eed6fa399090c27210e51c54553a20..ce2f7873d6aed3eeff7304e67abe7598b5c274c7 100644 (file)
@@ -18,6 +18,9 @@ private:
 
 public:
        Negation(const Shape<T, D> &);
+       Negation(const Negation &);
+       Negation &operator=(const Negation &);
+       ~Negation();
 
        virtual Negation *clone() const;
 
@@ -34,6 +37,25 @@ inline Negation<T, D>::Negation(const Shape<T, D> &s):
        shape(s.clone())
 { }
 
+template<typename T, unsigned D>
+inline Negation<T, D>::Negation(const Negation<T, D> &other):
+       shape(other.shape->clone())
+{ }
+
+template<typename T, unsigned D>
+inline Negation<T, D> &Negation<T, D>::operator=(const Negation<T, D> &other)
+{
+       delete shape;
+       shape = other.shape->clone();
+       return *this;
+}
+
+template<typename T, unsigned D>
+inline Negation<T, D>::~Negation()
+{
+       delete shape;
+}
+
 template<typename T, unsigned D>
 inline Negation<T, D> *Negation<T, D>::clone() const
 {