Skip to content

Commit eeb637b

Browse files
author
Conor
committed
!TMP faster
1 parent ee7c24b commit eeb637b

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

src/core/promise.cxx

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,16 @@ struct promise_deleter {
3232

3333
template <typename T>
3434
using unique_promise = std::unique_ptr<T, promise_deleter>;
35+
// template <typename T>
36+
// struct unique_promise {
37+
// T *a;
38+
//
39+
// constexpr auto operator*() noexcept -> T & { return *a; }
40+
// constexpr auto operator->() noexcept -> T * { return a; }
41+
// constexpr operator bool() const noexcept { return a != nullptr; }
42+
// constexpr auto release() noexcept -> T * { return a; }
43+
// constexpr auto operator==(std::nullptr_t) const noexcept -> bool { return a == nullptr; }
44+
// };
3545

3646
/**
3747
* @brief The return type for libfork's async functions/coroutines.
@@ -63,7 +73,7 @@ constexpr auto final_suspend(frame_type *frame) -> std::coroutine_handle<> {
6373

6474
{
6575
// Destroy the child frame
66-
unique_promise<frame_type> _{frame};
76+
promise_deleter::operator()(frame);
6777
}
6878

6979
if (parent_frame != nullptr) {
@@ -136,7 +146,7 @@ struct promise_type<void, StackPolicy> : StackPolicy, mixin_frame {
136146

137147
frame_type frame;
138148

139-
constexpr auto get_return_object() -> task<void, StackPolicy> { return {{this, {}}}; }
149+
constexpr auto get_return_object() -> task<void, StackPolicy> { return {{this}}; }
140150

141151
constexpr static void return_void() {}
142152
};

0 commit comments

Comments
 (0)