Hello, maybe somebody can help me, I have these errors:
Individual.cc: In member function ‘void Individual::setGene(int, Rama)’:
Individual.cc:39:33: error: no match for ‘operator=’ (operand types are ‘std::vector<Rama>’ and ‘Rama’)
chromosome->sequence[offset] = gene;
^~~~
In file included from /usr/include/c++/8/vector:69,
from Individual.cc:5:
/usr/include/c++/8/bits/vector.tcc:186:5: note: candidate: ‘std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(const std::vector<_Tp, _Alloc>&) [with _Tp = Rama; _Alloc = std::allocator<Rama>]’
vector<_Tp, _Alloc>::
chromosome->sequence is a vector of objects Rama
chromosome->sequence[offset] is an object of Rama
and *gene is an object of Rama
so I think the equivalence is correct
My project is to build a software that search a solution to a differential equation based in genetic algorithms, I hope somebody is interested in this project
vector<Rama>* sequence;
sequence is a pointer to a vector
So chromosome->sequence[offset] is a non-existent vector, in an array of vector that also doesn't exist, because that's what you're trying to reach when you use [] on a pointer; put short,
chromosome->sequence[offset] is a vector of objects of Rama, that doesn't even exist.