From c10a12f29ca57799c8767280f7b96586ada92131 Mon Sep 17 00:00:00 2001 From: Joscha Date: Sat, 20 May 2017 23:57:44 +0000 Subject: [PATCH] Fix improper Chromosome copy assingment operator --- src/Chromosome.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Chromosome.cpp b/src/Chromosome.cpp index eae6a21..9027ff9 100644 --- a/src/Chromosome.cpp +++ b/src/Chromosome.cpp @@ -59,6 +59,8 @@ Chromosome& Chromosome::operator=(const Chromosome& other) { // reserve to other's size/capacity? + this->genes.clear(); + if (this != &other) { for (auto& ptr : other.genes) { this->genes.push_back(std::unique_ptr(Gene::copy(ptr.get())));