mardi 18 décembre 2018

Explicit call to a value constructor after dereferencing an iterator to std::vector

  std::vector<std::uniform_real_distribution<double> > distribution_pos(10);
  for(auto it = distribution_pos.begin(); it != distribution_pos.end(); it++)
  {
     it->std::uniform_real_distribution<double>(0.0,1.0);
  }

I want to essentially declare a vector (size 10) of std::uniform_real_distribution<double> objects. And then I want to loop through this vector and call the value constructor for the object (the 0.0 and 1.0 numbers should change for each pass of the loop, but I omitted that here for succinctness). The above code does not appear to do what I want. Is it possible to make an explicit call to the value constructor after already declaring distribution_pos?




Aucun commentaire:

Enregistrer un commentaire