Additional optimization. Removed get() method from Generation.
[genetic.git] / src / generation.h
index f195d7e5d367a4d84bfe879b51154fc1c0b5739a..88942ec0d9fd2a0cac8e19b3762bee8cef227da8 100644 (file)
@@ -20,6 +20,7 @@ namespace genetic {
          */
         vector<_Chromosome> chromosomes;
 
+        template<typename> friend class Generation;
     public:
         /**
          * Default constructor
@@ -37,14 +38,7 @@ namespace genetic {
 
         /** Copy constructor */
         Generation(const Generation& generation)
-            : chromosomes(generation.get()) {
-        }
-
-        /**
-         * Allows read-only access to Generation Chromosomes
-         */
-        vector<_Chromosome> get() const {
-            return this->chromosomes;
+            : chromosomes(generation.chromosomes) {
         }
 
         /**
@@ -54,7 +48,7 @@ namespace genetic {
          * @return Generation instance containing copied Chromosomes
          */
         Generation& operator=(const Generation& generation){
-            this->chromosomes = generation.get();
+            this->chromosomes = generation.chromosomes;
             return *this;
         }