10 * Chromosome of given Genes.
12 template < typename _Gene >
16 * Type representing Chromosome Gene
18 typedef _Gene GeneType;
21 * Genes of the chromosome
23 std::vector<_Gene> genes;
25 template<typename> friend class Chromosome;
33 * Class constructor. Initializes Chromosome with the given Gene's
35 * @param genes vector containing Genes to use in Chromosome
37 Chromosome(const std::vector<_Gene>& genes) {
41 /** Copy constructor */
42 Chromosome(const Chromosome& chromosome)
43 : genes(chromosome.genes) {
49 * @param chromosome Chromosome from which the Genes should be copied.
50 * @return Chromosome instance containing copied Genes
52 Chromosome& operator=(const Chromosome& chromosome) {
53 this->genes = chromosome.genes;
58 * Returns number of Genes in current Chromosome
60 * @return number of Genes in current Chromosome
62 unsigned int size() const {
63 return this->genes.size();
67 * Returns i-th Gene in the current Chromosome
69 * @return i-th Gene in the current Chromosome
71 _Gene& operator[](const unsigned int i) {
72 return this->genes[i];
77 #endif /* __CHROMOSOME_H */