Unfortunately this is tied to the behavior inside the underlying "Parallel Patterns Library" implementation. Calling
This feature, however, means that non-copiable objects can't be used in tasks.
Most types inside cpprest use shared_ptr semantics to make their use easier: they're movable, copiable, and you don't have to worry about them being destroyed before completing.
.get()
on a task will return a copy of the object, making it safe to chain multiple continuations off of the same task as they cannot interact with each other.This feature, however, means that non-copiable objects can't be used in tasks.
Most types inside cpprest use shared_ptr semantics to make their use easier: they're movable, copiable, and you don't have to worry about them being destroyed before completing.