Fix improper Chromosome copy assingment operator
This commit is contained in:
parent
901a5f2b3c
commit
c10a12f29c
1 changed files with 2 additions and 0 deletions
|
|
@ -59,6 +59,8 @@ Chromosome& Chromosome::operator=(const Chromosome& other)
|
||||||
{
|
{
|
||||||
// reserve to other's size/capacity?
|
// reserve to other's size/capacity?
|
||||||
|
|
||||||
|
this->genes.clear();
|
||||||
|
|
||||||
if (this != &other) {
|
if (this != &other) {
|
||||||
for (auto& ptr : other.genes) {
|
for (auto& ptr : other.genes) {
|
||||||
this->genes.push_back(std::unique_ptr<Gene>(Gene::copy(ptr.get())));
|
this->genes.push_back(std::unique_ptr<Gene>(Gene::copy(ptr.get())));
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue