How could i initialize vector<class> in a class object?

Hello everyone,

I want to make a class, named generation, having a vector<chromosome> type data member.
chromosome is also class name.
chromosome has a 'route' as data member, which type is class TArrayI defined in ROOT package.
the size of route is to be fixed according to parameters of generation class object.

class chromosome{
public: chromosome(){;}

TArrayI route;

class generation{
public: generation(int PopSize=300, int numCity = 36){

vector<chromosome> Population;


I want each element, chromosome of Population, to have a numCity size of route.
thank you advance for your helps.
Last edited on
You could do it in the constructor, or in the initialization list of the constructor.
Thank you, i'll try it.
Topic archived. No new replies allowed.