diff options
author | Nao Pross <naopross@thearcway.org> | 2019-02-02 23:23:10 +0100 |
---|---|---|
committer | Nao Pross <naopross@thearcway.org> | 2019-02-02 23:23:10 +0100 |
commit | 878d95f84ac90bcd614a88b9510a6439c8894827 (patch) | |
tree | 6db7eb121c99cef4c84df85e348a36ca15670c63 | |
parent | Fix few pointer casts (diff) | |
download | flatland-878d95f84ac90bcd614a88b9510a6439c8894827.tar.gz flatland-878d95f84ac90bcd614a88b9510a6439c8894827.zip |
Update task to use lambda instead of std::bind
Because apparently lambdas are faster and more optimized
-rw-r--r-- | engine/include/core/task.hpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/engine/include/core/task.hpp b/engine/include/core/task.hpp index 0840e08..d124adf 100644 --- a/engine/include/core/task.hpp +++ b/engine/include/core/task.hpp @@ -39,7 +39,9 @@ namespace flat { /// this allows to make the task die when the owner object goes out of scope template<typename R, typename T> inline std::shared_ptr<task> delegate_task(R T::*mf, T* obj, priority_t p = priority_t::none) { - return delegate_task(std::bind(mf, obj), p); + return delegate_task(static_cast<task::callback>([=]() -> void { + (obj->*mf)(); + }), p); } /// run tasks |