Container mit std::packaged_task
Verfasst: 27.12.2013, 19:31
Hi,
ich versuche gerade in VS 2013 eine std::list mit std::packaged_tasks zu erstellen:
Ist es irgendwie schlecht, oder verboten das zu tun? Ich habe schon ewig viel probiert und rumgefummelt, aber erfolglos. Und die Compiler-Fehler bringen mich auch nicht weiter (die kommen sobald die Zeile mit dem push_back drin ist).
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.
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.