From: Marcus Fritzsch Date: Wed, 28 Jun 2017 14:36:54 +0000 (+0200) Subject: wayland: wayland_proxy ctor improvement X-Git-Tag: 4.99.1~287 X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=commitdiff_plain;h=053ca969fe869d38d92319415e2a8cacbaebf0e7;p=staging%2Fwindowmanager.git 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 --- 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(p)); - }) {} - wayland_proxy(void *p, std::function p_del) + : wayland_proxy(p, + reinterpret_cast(wl_proxy_destroy)) {} + wayland_proxy(void *p, std::function &&p_del) : proxy(std::unique_ptr>( static_cast(p), p_del)) {} };