diff --git a/include/async++/task.h b/include/async++/task.h index 7735c30..597d3e3 100644 --- a/include/async++/task.h +++ b/include/async++/task.h @@ -294,6 +294,17 @@ class shared_task: public detail::basic_task { // Movable and copyable shared_task() = default; + // Move constructor for task + shared_task(task&& other) LIBASYNC_NOEXCEPT + : detail::basic_task(std::move(other)) {} + + // Move-assignment for task + shared_task& operator=(task&& other) LIBASYNC_NOEXCEPT + { + detail::basic_task::operator=(std::move(other)); + return *this; + } + // Get the result of the task get_result get() const { diff --git a/include/async++/task_base.h b/include/async++/task_base.h index 2f16e7e..595f31c 100644 --- a/include/async++/task_base.h +++ b/include/async++/task_base.h @@ -65,13 +65,13 @@ struct LIBASYNC_CACHELINE_ALIGN task_base: public ref_count_base state; // Whether get_task() was already called on an event_task - bool event_task_got_task; + bool event_task_got_task{}; // Vector of continuations continuation_vector continuations; // Virtual function table used for dynamic dispatch - const task_base_vtable* vtable; + const task_base_vtable* vtable{}; // Use aligned memory allocation static void* operator new(std::size_t size)