Files
MapLibreParticleLab/include/mln/util/work_task.hpp
Bart Louwers 2a8ebc4906 core: rename mbgl directories to mln (#4511)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2026-08-22 20:50:14 +02:00

25 lines
603 B
C++

#pragma once
#include <mln/util/noncopyable.hpp>
#include <memory>
namespace mln {
/// A movable type-erasing function wrapper. This allows to store arbitrary
/// invocable things (like std::function<>, or the result of a movable-only
/// std::bind()) in the queue. Source:
/// http://stackoverflow.com/a/29642072/331379
class WorkTask : private util::noncopyable {
public:
virtual ~WorkTask() = default;
virtual void operator()() = 0;
virtual void cancel() = 0;
template <class Fn, class... Args>
static std::shared_ptr<WorkTask> make(Fn&&, Args&&...);
};
} // namespace mln