samedi 28 décembre 2019

How to Pass Vector Elements Into a Class

the following is the code for iterating over a vector object called cells. I am trying to pass each integer in this vector as an object into a class called Cell. Then the vector element should be passed to another vector threads as a parameter for the function function. I'm not sure what I'm doing wrong and would love any suggestions regarding this!

  for (int unsigned ii = 0; ii < cells.size(); ii ++) {
        cells.push_back(Cell(cells.at(ii)));
        threads.push_back(std::thread(function, cells[ii]));
    }

Aucun commentaire:

Enregistrer un commentaire