feat: initialization of eoVector from std::vector
Useful to brace-init hard-coded vectors.
This commit is contained in:
parent
5a64a1755a
commit
4d51fb8132
2 changed files with 15 additions and 2 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue