samedi 31 octobre 2015

discrete_distrubution of struct

I had a vector of real values:

vector<double> values;

and a discrete_distribution:

discrete_distribution<size_t> dis(values.begin(), values.end());

But now I need that the vector of double values becomes a vector of structures:

struct Data
{
   double value;
   int index;
};

vector<Data> values;

How can I build the corresponding discrete_distribution without making a copy of the values into a separated vector?

Aucun commentaire:

Enregistrer un commentaire