Skip to content

Commit 39e3251

Browse files
author
Conor
committed
Revert "!TMP faster"
This reverts commit ca602b7.
1 parent ca602b7 commit 39e3251

File tree

1 file changed

+3
-14
lines changed

1 file changed

+3
-14
lines changed

src/core/promise.cxx

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -30,19 +30,8 @@ struct promise_deleter {
3030
}
3131
};
3232

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

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

7564
{
7665
// Destroy the child frame
77-
promise_deleter::operator()(frame);
66+
unique_promise<frame_type> _{frame};
7867
}
7968

8069
if (parent_frame != nullptr) {
@@ -147,7 +136,7 @@ struct promise_type<void, StackPolicy> : StackPolicy, mixin_frame {
147136

148137
frame_type frame;
149138

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

152141
constexpr static void return_void() {}
153142
};

0 commit comments

Comments
 (0)