summaryrefslogtreecommitdiff
path: root/src/bindings
diff options
context:
space:
mode:
authorVitor Sousa <vitorsousasilva@gmail.com>2015-05-22 10:31:18 +0100
committerDaniel Kolesa <d.kolesa@osg.samsung.com>2015-05-22 10:31:18 +0100
commitf45f3e9f13de1f1f6ab836867f6a3e365a7b971d (patch)
tree092fcd070caf11a0248200c4fddf9af40498271f /src/bindings
parent7d1a27bae9b632dfd16e9d4641f633ad0c93ba4d (diff)
eina_cxx, eldbus_cxx: Fix perfect forwarding of arguments
Summary: Changed some std::move clauses to std::forward<Type> in order to allow perfect forwarding. @fix Reviewers: felipealmeida, JackDanielZ, tasn, q66 Reviewed By: q66 Subscribers: cedric Differential Revision: https://phab.enlightenment.org/D2508
Diffstat (limited to 'src/bindings')
-rw-r--r--src/bindings/eina_cxx/eina_tuple_unwrap.hh8
-rw-r--r--src/bindings/eldbus_cxx/eldbus_basic.hh4
-rw-r--r--src/bindings/eldbus_cxx/eldbus_freedesktop.hh2
-rw-r--r--src/bindings/eldbus_cxx/eldbus_proxy_call.hh10
4 files changed, 12 insertions, 12 deletions
diff --git a/src/bindings/eina_cxx/eina_tuple_unwrap.hh b/src/bindings/eina_cxx/eina_tuple_unwrap.hh
index 379f492e92..f2bbb0022e 100644
--- a/src/bindings/eina_cxx/eina_tuple_unwrap.hh
+++ b/src/bindings/eina_cxx/eina_tuple_unwrap.hh
@@ -18,9 +18,9 @@ template <typename Callable, typename T, std::size_t... S
18auto call_tuple_unwrap_prefix(Callable const& callable, T const& tuple 18auto call_tuple_unwrap_prefix(Callable const& callable, T const& tuple
19 , eina::index_sequence<S...> 19 , eina::index_sequence<S...>
20 , Args&&... args) 20 , Args&&... args)
21 -> decltype(callable(std::move(args)..., std::get<S>(tuple)...)) 21 -> decltype(callable(std::forward<Args>(args)..., std::get<S>(tuple)...))
22{ 22{
23 return callable(std::move(args)..., std::get<S>(tuple)...); 23 return callable(std::forward<Args>(args)..., std::get<S>(tuple)...);
24} 24}
25 25
26template <typename Callable, typename T, std::size_t... S 26template <typename Callable, typename T, std::size_t... S
@@ -28,9 +28,9 @@ template <typename Callable, typename T, std::size_t... S
28auto call_tuple_unwrap_suffix(Callable const& callable, T const& tuple 28auto call_tuple_unwrap_suffix(Callable const& callable, T const& tuple
29 , eina::index_sequence<S...> 29 , eina::index_sequence<S...>
30 , Args&&... args) 30 , Args&&... args)
31 -> decltype(callable(std::get<S>(tuple)..., std::move(args)...)) 31 -> decltype(callable(std::get<S>(tuple)..., std::forward<Args>(args)...))
32{ 32{
33 return callable(std::get<S>(tuple)..., std::move(args)...); 33 return callable(std::get<S>(tuple)..., std::forward<Args>(args)...);
34} 34}
35 35
36} } 36} }
diff --git a/src/bindings/eldbus_cxx/eldbus_basic.hh b/src/bindings/eldbus_cxx/eldbus_basic.hh
index 8dc3751bcf..aa287b4cfd 100644
--- a/src/bindings/eldbus_cxx/eldbus_basic.hh
+++ b/src/bindings/eldbus_cxx/eldbus_basic.hh
@@ -43,13 +43,13 @@ struct proxy
43 template <typename R, typename Callback, typename... Args> 43 template <typename R, typename Callback, typename... Args>
44 void call(const char* method, double timeout, Callback&& callback, Args... args) const 44 void call(const char* method, double timeout, Callback&& callback, Args... args) const
45 { 45 {
46 eldbus::_detail::proxy_call<R>(_proxy, method, timeout, std::move(callback), args...); 46 eldbus::_detail::proxy_call<R>(_proxy, method, timeout, std::forward<Callback>(callback), args...);
47 } 47 }
48 48
49 template <typename Callback, typename... Args> 49 template <typename Callback, typename... Args>
50 void call(const char* method, double timeout, Callback&& callback, Args... args) const 50 void call(const char* method, double timeout, Callback&& callback, Args... args) const
51 { 51 {
52 eldbus::_detail::proxy_call<void>(_proxy, method, timeout, std::move(callback), args...); 52 eldbus::_detail::proxy_call<void>(_proxy, method, timeout, std::forward<Callback>(callback), args...);
53 } 53 }
54 54
55 native_handle_type native_handle() { return _proxy; } 55 native_handle_type native_handle() { return _proxy; }
diff --git a/src/bindings/eldbus_cxx/eldbus_freedesktop.hh b/src/bindings/eldbus_cxx/eldbus_freedesktop.hh
index 7bd39f9f6c..e44b9b228d 100644
--- a/src/bindings/eldbus_cxx/eldbus_freedesktop.hh
+++ b/src/bindings/eldbus_cxx/eldbus_freedesktop.hh
@@ -61,7 +61,7 @@ void _free_cb(void* data, const void*)
61template <typename... Ins, typename F> 61template <typename... Ins, typename F>
62pending name_request(connection& c, const char* bus, unsigned int flags, F&& function) 62pending name_request(connection& c, const char* bus, unsigned int flags, F&& function)
63{ 63{
64 F* f = new F(std::move(function)); 64 F* f = new F(std::forward<F>(function));
65 pending r = ::eldbus_name_request(c.native_handle(), bus, flags 65 pending r = ::eldbus_name_request(c.native_handle(), bus, flags
66 , &_detail::_callback_wrapper<F, Ins...>, f); 66 , &_detail::_callback_wrapper<F, Ins...>, f);
67 eldbus_pending_free_cb_add(r.native_handle(), &_detail::_free_cb<F>, f); 67 eldbus_pending_free_cb_add(r.native_handle(), &_detail::_free_cb<F>, f);
diff --git a/src/bindings/eldbus_cxx/eldbus_proxy_call.hh b/src/bindings/eldbus_cxx/eldbus_proxy_call.hh
index 9f1ddd8747..f06f71a1b8 100644
--- a/src/bindings/eldbus_cxx/eldbus_proxy_call.hh
+++ b/src/bindings/eldbus_cxx/eldbus_proxy_call.hh
@@ -74,7 +74,7 @@ void proxy_call_impl2(Eldbus_Proxy* proxy, const char* method, double timeout
74 _detail::init_signature_array<Args...> 74 _detail::init_signature_array<Args...>
75 (signature, eina::make_index_sequence<signature_size<tuple_args>::value +1>()); 75 (signature, eina::make_index_sequence<signature_size<tuple_args>::value +1>());
76 76
77 Callback* c = new Callback(std::move(callback)); 77 Callback* c = new Callback(std::forward<Callback>(callback));
78 78
79 eldbus_proxy_call(proxy, method, &_on_call<R, Callback>, c, timeout, signature 79 eldbus_proxy_call(proxy, method, &_on_call<R, Callback>, c, timeout, signature
80 , _detail::to_raw(args)...); 80 , _detail::to_raw(args)...);
@@ -85,7 +85,7 @@ void proxy_call_impl(tag<R>, Eldbus_Proxy* proxy, const char* method, double tim
85 , Callback&& callback, Args const&... args) 85 , Callback&& callback, Args const&... args)
86{ 86{
87 typedef std::tuple<R> reply_tuple; 87 typedef std::tuple<R> reply_tuple;
88 _detail::proxy_call_impl2<reply_tuple>(proxy, method, timeout, std::move(callback), args...); 88 _detail::proxy_call_impl2<reply_tuple>(proxy, method, timeout, std::forward<Callback>(callback), args...);
89} 89}
90 90
91template <typename... R, typename Callback, typename... Args> 91template <typename... R, typename Callback, typename... Args>
@@ -93,7 +93,7 @@ void proxy_call_impl(tag<std::tuple<R...> >, Eldbus_Proxy* proxy, const char* me
93 , Callback&& callback, Args const&... args) 93 , Callback&& callback, Args const&... args)
94{ 94{
95 typedef std::tuple<R...> reply_tuple; 95 typedef std::tuple<R...> reply_tuple;
96 _detail::proxy_call_impl2<reply_tuple>(proxy, method, timeout, std::move(callback), args...); 96 _detail::proxy_call_impl2<reply_tuple>(proxy, method, timeout, std::forward<Callback>(callback), args...);
97} 97}
98 98
99template <typename Callback, typename... Args> 99template <typename Callback, typename... Args>
@@ -101,14 +101,14 @@ void proxy_call_impl(tag<void>, Eldbus_Proxy* proxy, const char* method, double
101 , Callback&& callback, Args const&... args) 101 , Callback&& callback, Args const&... args)
102{ 102{
103 typedef std::tuple<> reply_tuple; 103 typedef std::tuple<> reply_tuple;
104 _detail::proxy_call_impl2<reply_tuple>(proxy, method, timeout, std::move(callback), args...); 104 _detail::proxy_call_impl2<reply_tuple>(proxy, method, timeout, std::forward<Callback>(callback), args...);
105} 105}
106 106
107template <typename R, typename Callback, typename... Args> 107template <typename R, typename Callback, typename... Args>
108void proxy_call(Eldbus_Proxy* proxy, const char* method, double timeout 108void proxy_call(Eldbus_Proxy* proxy, const char* method, double timeout
109 , Callback&& callback, Args const&... args) 109 , Callback&& callback, Args const&... args)
110{ 110{
111 return proxy_call_impl(tag<R>(), proxy, method, timeout, std::move(callback), args...); 111 return proxy_call_impl(tag<R>(), proxy, method, timeout, std::forward<Callback>(callback), args...);
112} 112}
113 113
114} } } 114} } }