class MoveOnlyOperation
{
public:
MoveOnlyOperation() = default;
MoveOnlyOperation(const MoveOnlyOperation&) = delete;
MoveOnlyOperation(MoveOnlyOperation&&) = default;
int operator()()
{
return 0;
}
};
I want to wrap an object instance inside a packaged_task like this:
std::packaged_task<void()> task(MoveOnlyOperation{});
I get "error C2280: 'MoveOnlyOperation::MoveOnlyOperation(const MoveOnlyOperation &)': attempting to reference a deleted function"
The documentation for C++ 11 says one can perfect forward the instance inside the packaged_task though. I also don't have issues with clang.
It there something implementation defined about how packaged_task should be implemented or a bug in VS 2015 (and possibly later because I get same issue with http://rextester.com/WBEH22233)
Aucun commentaire:
Enregistrer un commentaire