X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Fmathed%2FMathAtom.cpp;h=10f52174b6f44a73f0d90fa5c9af9b561cf0c233;hb=38c2cde0d8695ac5287bae218c4a33a2acf18ef8;hp=a8483ea212cd0b07e91840dbfd05420282dc93e5;hpb=07924ac300f68eaf4825951af6a6ac3c14d6edd6;p=lyx.git diff --git a/src/mathed/MathAtom.cpp b/src/mathed/MathAtom.cpp index a8483ea212..10f52174b6 100644 --- a/src/mathed/MathAtom.cpp +++ b/src/mathed/MathAtom.cpp @@ -18,37 +18,20 @@ using namespace std; namespace lyx { -MathAtom::MathAtom() - : nucleus_(0) -{} - - MathAtom::MathAtom(InsetMath * p) : nucleus_(p) {} MathAtom::MathAtom(MathAtom const & at) - : nucleus_(0) -{ - if (at.nucleus_) - nucleus_ = static_cast(at.nucleus_->clone()); -} + : nucleus_(at.nucleus_ ? static_cast(at->clone()) : nullptr) +{} MathAtom & MathAtom::operator=(MathAtom const & at) { - if (&at == this) - return *this; - MathAtom tmp(at); - swap(tmp.nucleus_, nucleus_); - return *this; -} - - -MathAtom::~MathAtom() -{ - delete nucleus_; + // copy then move-assign + return operator=(MathAtom(at)); }