feat: initialization of eoVector from std::vector

Useful to brace-init hard-coded vectors.
This commit is contained in:
Johann Dreo 2020-04-22 07:58:52 +02:00
commit 4d51fb8132
2 changed files with 15 additions and 2 deletions

View file

@ -45,8 +45,15 @@ template <class FitT> class eoInt: public eoVector<FitT, int>
* @param size Size of the std::vector
* @param value fill the vector with this value
*/
eoInt(unsigned size = 0, int value = 0):
eoVector<FitT, int>(size, value) {}
eoInt(unsigned size = 0, int value = 0) :
eoVector<FitT, int>(size, value)
{}
/** Constructor copying from a vector (or an initialization list).
*/
eoInt(std::vector<int> vec) :
eoVector<FitT, int>(vec)
{}
/// My class name.
virtual std::string className() const

View file

@ -73,6 +73,12 @@ public:
: EO<FitT>(), std::vector<GeneType>(_size, _value)
{}
/** Constructor copying from a vector (or an initialization list).
*/
eoVector( std::vector<GeneType> vec )
: EO<FitT>(), std::vector<GeneType>(vec)
{}
/// copy ctor abstracting from the FitT
template <class OtherFitnessType>
eoVector(const eoVector<OtherFitnessType, GeneType>& _vec) : std::vector<GeneType>(_vec)