lundi 10 mai 2021

How to store and retrieve a std::future object from a vector [closed]

I'm receiving a segmentation fault when I try to store a std::future object from a std::async call that has a function that returns a float array.

std::vector<std::future<float*>> output;
for(i=0;i<5;i++)
{
   //Segmentation fault on the line below.
   output.pushback(std::async(std::launch::async,func,arg1,arg2,i)) // func returns a float array
}

I do not understand the mistake I am making here. Is there any other way to store float arrays returned by a function called using std::async.? Thank you for your time and help in advance.

Aucun commentaire:

Enregistrer un commentaire