promise lifetime ?
wenzhang-dev opened this issue · 1 comments
wenzhang-dev commented
promise p;
p.then([](int a) {
return 1;
}.then(int b) {
return 2;
});
p.resolve(3);
|then| member function actully calls |attach|, and push lambda/callback into std::vector<>.
the quesion is when p invokes the first |then|, and own this callback and states, however, the second |then| will new a promise, and nobody owns this callback.
so when i try to call p.resolve(3), which only trigger the first calback execution ?
wenzhang-dev commented