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())));