This commit is contained in:
Attila Uygun 2023-07-29 00:47:18 +02:00
parent 26a1270702
commit 571a21914c
1 changed files with 3 additions and 2 deletions

View File

@ -22,7 +22,7 @@ void ReturnAsParamAdapter(std::function<ReturnType()> func,
*result = func(); *result = func();
} }
// Adapts a ReturnType* result to a callblack that expects a ReturnType. // Adapts a ReturnType* result to a callback that expects a ReturnType.
template <typename ReturnType> template <typename ReturnType>
void ReplyAdapter(std::function<void(ReturnType)> callback, void ReplyAdapter(std::function<void(ReturnType)> callback,
std::shared_ptr<ReturnType> result) { std::shared_ptr<ReturnType> result) {
@ -65,9 +65,10 @@ class TaskRunner {
front); front);
} }
// Posts a task to delete the given object. // Posts a task that deletes the given object.
template <class T> template <class T>
void Delete(Location from, std::unique_ptr<T> object) { void Delete(Location from, std::unique_ptr<T> object) {
// std::function target must be copy-constructible
std::shared_ptr<T> owned = std::move(object); std::shared_ptr<T> owned = std::move(object);
PostTask(HERE, [owned]() {}); PostTask(HERE, [owned]() {});
} }