q66 pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=f45f3e9f13de1f1f6ab836867f6a3e365a7b971d

commit f45f3e9f13de1f1f6ab836867f6a3e365a7b971d
Author: Vitor Sousa <vitorsousasi...@gmail.com>
Date:   Fri May 22 10:31:18 2015 +0100

    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
---
 src/bindings/eina_cxx/eina_tuple_unwrap.hh    |  8 ++++----
 src/bindings/eldbus_cxx/eldbus_basic.hh       |  4 ++--
 src/bindings/eldbus_cxx/eldbus_freedesktop.hh |  2 +-
 src/bindings/eldbus_cxx/eldbus_proxy_call.hh  | 10 +++++-----
 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 379f492..f2bbb00 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
 auto call_tuple_unwrap_prefix(Callable const& callable, T const& tuple
                               , eina::index_sequence<S...>
                               , Args&&... args)
-  -> decltype(callable(std::move(args)..., std::get<S>(tuple)...))
+  -> decltype(callable(std::forward<Args>(args)..., std::get<S>(tuple)...))
 {
-  return callable(std::move(args)..., std::get<S>(tuple)...);
+  return callable(std::forward<Args>(args)..., std::get<S>(tuple)...);
 }
 
 template <typename Callable, typename T, std::size_t... S
@@ -28,9 +28,9 @@ template <typename Callable, typename T, std::size_t... S
 auto call_tuple_unwrap_suffix(Callable const& callable, T const& tuple
                               , eina::index_sequence<S...>
                               , Args&&... args)
-  -> decltype(callable(std::get<S>(tuple)..., std::move(args)...))
+  -> decltype(callable(std::get<S>(tuple)..., std::forward<Args>(args)...))
 {
-  return callable(std::get<S>(tuple)..., std::move(args)...);
+  return callable(std::get<S>(tuple)..., std::forward<Args>(args)...);
 }
 
 } }
diff --git a/src/bindings/eldbus_cxx/eldbus_basic.hh 
b/src/bindings/eldbus_cxx/eldbus_basic.hh
index 8dc3751..aa287b4 100644
--- a/src/bindings/eldbus_cxx/eldbus_basic.hh
+++ b/src/bindings/eldbus_cxx/eldbus_basic.hh
@@ -43,13 +43,13 @@ struct proxy
   template <typename R, typename Callback, typename... Args>
   void call(const char* method, double timeout, Callback&& callback, Args... 
args) const
   {
-    eldbus::_detail::proxy_call<R>(_proxy, method, timeout, 
std::move(callback), args...);
+    eldbus::_detail::proxy_call<R>(_proxy, method, timeout, 
std::forward<Callback>(callback), args...);
   }
 
   template <typename Callback, typename... Args>
   void call(const char* method, double timeout, Callback&& callback, Args... 
args) const
   {
-    eldbus::_detail::proxy_call<void>(_proxy, method, timeout, 
std::move(callback), args...);
+    eldbus::_detail::proxy_call<void>(_proxy, method, timeout, 
std::forward<Callback>(callback), args...);
   }
 
   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 7bd39f9..e44b9b2 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*)
 template <typename... Ins, typename F>
 pending name_request(connection& c, const char* bus, unsigned int flags, F&& 
function)
 {
-  F* f = new F(std::move(function));
+  F* f = new F(std::forward<F>(function));
   pending r = ::eldbus_name_request(c.native_handle(), bus, flags
                                     , &_detail::_callback_wrapper<F, Ins...>, 
f);
   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 9f1ddd8..f06f71a 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
   _detail::init_signature_array<Args...>
     (signature, eina::make_index_sequence<signature_size<tuple_args>::value 
+1>());
 
-  Callback* c = new Callback(std::move(callback));
+  Callback* c = new Callback(std::forward<Callback>(callback));
 
   eldbus_proxy_call(proxy, method, &_on_call<R, Callback>, c, timeout, 
signature
                     , _detail::to_raw(args)...);
@@ -85,7 +85,7 @@ void proxy_call_impl(tag<R>, Eldbus_Proxy* proxy, const char* 
method, double tim
                      , Callback&& callback, Args const&... args)
 {
   typedef std::tuple<R> reply_tuple;
-  _detail::proxy_call_impl2<reply_tuple>(proxy, method, timeout, 
std::move(callback), args...);
+  _detail::proxy_call_impl2<reply_tuple>(proxy, method, timeout, 
std::forward<Callback>(callback), args...);
 }
 
 template <typename... R, typename Callback, typename... Args>
@@ -93,7 +93,7 @@ void proxy_call_impl(tag<std::tuple<R...> >, Eldbus_Proxy* 
proxy, const char* me
                      , Callback&& callback, Args const&... args)
 {
   typedef std::tuple<R...> reply_tuple;
-  _detail::proxy_call_impl2<reply_tuple>(proxy, method, timeout, 
std::move(callback), args...);
+  _detail::proxy_call_impl2<reply_tuple>(proxy, method, timeout, 
std::forward<Callback>(callback), args...);
 }
 
 template <typename Callback, typename... Args>
@@ -101,14 +101,14 @@ void proxy_call_impl(tag<void>, Eldbus_Proxy* proxy, 
const char* method, double
                      , Callback&& callback, Args const&... args)
 {
   typedef std::tuple<> reply_tuple;
-  _detail::proxy_call_impl2<reply_tuple>(proxy, method, timeout, 
std::move(callback), args...);
+  _detail::proxy_call_impl2<reply_tuple>(proxy, method, timeout, 
std::forward<Callback>(callback), args...);
 }
 
 template <typename R, typename Callback, typename... Args>
 void proxy_call(Eldbus_Proxy* proxy, const char* method, double timeout
                 , Callback&& callback, Args const&... args)
 {
-  return proxy_call_impl(tag<R>(), proxy, method, timeout, 
std::move(callback), args...);
+  return proxy_call_impl(tag<R>(), proxy, method, timeout, 
std::forward<Callback>(callback), args...);
 }
 
 } } }

-- 


Reply via email to