MCPcopy Create free account
hub / github.com/David-Haim/concurrencpp / build

Method build

source/task.cpp:53–74  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

51using concurrencpp::details::coroutine_handle_functor;
52
53void task::build(task&& rhs) noexcept {
54 m_vtable = std::exchange(rhs.m_vtable, nullptr);
55 if (m_vtable == nullptr) {
56 return;
57 }
58
59 if (contains<coroutine_handle_functor>(m_vtable)) {
60 return callable_vtable<coroutine_handle_functor>::move_destroy(rhs.m_buffer, m_buffer);
61 }
62
63 if (contains<await_via_functor>(m_vtable)) {
64 return callable_vtable<await_via_functor>::move_destroy(rhs.m_buffer, m_buffer);
65 }
66
67 const auto move_destroy_fn = m_vtable->move_destroy_fn;
68 if (vtable::trivially_copiable_destructible(move_destroy_fn)) {
69 std::memcpy(m_buffer, rhs.m_buffer, details::task_constants::buffer_size);
70 return;
71 }
72
73 move_destroy_fn(rhs.m_buffer, m_buffer);
74}
75
76void task::build(details::coroutine_handle<void> coro_handle) noexcept {
77 build(details::coroutine_handle_functor {coro_handle});

Callers

nothing calls this directly

Calls 1

buildFunction · 0.50

Tested by

no test coverage detected