mardi 23 février 2016

boost thread_group move ownership of unique_ptr to thread

What workaround exists to make this code run? The code results in "Attempting to reference a deleted function". unique_ptr is assigned in a loop and then passed on to thread and later got rid of.

boost::thread_group threads;
std::unique_ptr<ScenarioResult> scenario_result;

while ((scenario_result = scenarioStock.getNextScenario()) != nullptr)
{
threads.create_thread(boost::bind(&Simulation::RunSimulation, boost::ref(grid_sim), std::move(scenario_result)));
}

Aucun commentaire:

Enregistrer un commentaire