diff options
author | Marcus Fritzsch <marcus_fritzsch@mentor.com> | 2017-06-28 16:36:54 +0200 |
---|---|---|
committer | Marcus Fritzsch <marcus_fritzsch@mentor.com> | 2017-08-08 17:24:00 +0200 |
commit | 053ca969fe869d38d92319415e2a8cacbaebf0e7 (patch) | |
tree | 1df3ad850a248c7b7600cdb8e921a3d8321dfbf4 | |
parent | 4bfc9ea5a9a5598aceb4e3e43fd2ade99d789200 (diff) |
wayland: wayland_proxy ctor improvement
* Take the std::function by rval reference.
* Do not create a lambda for the wl_proxy_destroy deleter.
Signed-off-by: Marcus Fritzsch <marcus_fritzsch@mentor.com>
-rw-r--r-- | src/wayland.hpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/wayland.hpp b/src/wayland.hpp index c47e218..5917abf 100644 --- a/src/wayland.hpp +++ b/src/wayland.hpp @@ -22,10 +22,9 @@ struct wayland_proxy { wayland_proxy(wayland_proxy const &) = delete; wayland_proxy &operator=(wayland_proxy const &) = delete; wayland_proxy(void *p) - : wayland_proxy(p, [](ProxyT *p) { - wl_proxy_destroy(reinterpret_cast<struct wl_proxy *>(p)); - }) {} - wayland_proxy(void *p, std::function<void(ProxyT *)> p_del) + : wayland_proxy(p, + reinterpret_cast<void (*)(ProxyT *)>(wl_proxy_destroy)) {} + wayland_proxy(void *p, std::function<void(ProxyT *)> &&p_del) : proxy(std::unique_ptr<ProxyT, std::function<void(ProxyT *)>>( static_cast<ProxyT *>(p), p_del)) {} }; |