This commit is contained in:
Zengtudor 2025-07-15 16:55:30 +08:00
parent 038c1170fd
commit 5fe8a0d976
2 changed files with 3 additions and 3 deletions

View File

@ -2,7 +2,7 @@
#include <future>
namespace zt{
template<class T>
struct Task{
struct Task:std::coroutine_handle<T>{
struct promise_type;
struct promise_type{
std::promise<T> promise_;
@ -14,7 +14,7 @@ namespace zt{
return std::suspend_always{};
}
auto get_return_object(){
return Task<T>{};
return Task<T>::from_promise(*this);
}
void unhandled_exception(){
return;

View File

@ -11,5 +11,5 @@ zt::Task<int> return0(){
int main(){
auto ret = return0();
ret.promise_type
ret.promise_type;
}