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
|
|
@ -46,7 +46,14 @@ template <class FitT> class eoInt: public eoVector<FitT, int>
|
||||||
* @param value fill the vector with this value
|
* @param value fill the vector with this value
|
||||||
*/
|
*/
|
||||||
eoInt(unsigned size = 0, int value = 0) :
|
eoInt(unsigned size = 0, int value = 0) :
|
||||||
eoVector<FitT, int>(size, value) {}
|
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.
|
/// My class name.
|
||||||
virtual std::string className() const
|
virtual std::string className() const
|
||||||
|
|
|
||||||
|
|
@ -73,6 +73,12 @@ public:
|
||||||
: EO<FitT>(), std::vector<GeneType>(_size, _value)
|
: 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
|
/// copy ctor abstracting from the FitT
|
||||||
template <class OtherFitnessType>
|
template <class OtherFitnessType>
|
||||||
eoVector(const eoVector<OtherFitnessType, GeneType>& _vec) : std::vector<GeneType>(_vec)
|
eoVector(const eoVector<OtherFitnessType, GeneType>& _vec) : std::vector<GeneType>(_vec)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue