ich versuche gerade in VS 2013 eine std::list mit std::packaged_tasks zu erstellen:
Code: Alles auswählen
#include <list>
#include <future>
int main(int argc, const char * argv[])
{
std::list<std::packaged_task<void ()>> taskList;
std::packaged_task<void ()> task([] ()
{
int i = 9;
i++;
i--;
});
taskList.push_back(std::move(task));
return 0;
}
error C2665: 'std::forward' : none of the 2 overloads could convert all the argument types
error C2512: 'std::_Promise<int>' : no appropriate default constructor available
error C2182: '_Val' : illegal use of type 'void'
error C2182: '_Val' : illegal use of type 'void'
error C2182: '_Get_value' : illegal use of type 'void'
Benutzen würde ich das gern in einem Ressourcen Manager. der auch das asynchrone Laden von Ressourcen ermöglichen soll.