[libsigcplusplus] limit_derived_target: Use perfect forwarding.
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libsigcplusplus] limit_derived_target: Use perfect forwarding.
- Date: Fri, 1 Apr 2016 08:31:56 +0000 (UTC)
commit eecc0b17fb4a46a8bf64aa79ffd3ec0055f056df
Author: Murray Cumming <murrayc murrayc com>
Date: Fri Apr 1 10:01:38 2016 +0200
limit_derived_target: Use perfect forwarding.
sigc++/visit_each.h | 11 ++++++-----
1 files changed, 6 insertions(+), 5 deletions(-)
---
diff --git a/sigc++/visit_each.h b/sigc++/visit_each.h
index 5daaf85..7d4f27d 100644
--- a/sigc++/visit_each.h
+++ b/sigc++/visit_each.h
@@ -30,7 +30,8 @@ namespace internal
template <class Base, class Derived>
constexpr bool is_base_of_or_same_v =
- std::is_base_of<Base, Derived>::value || std::is_same<Base, Derived>::value;
+ std::is_base_of<std::decay_t<Base>, std::decay_t<Derived>>::value ||
+ std::is_same<std::decay_t<Base>, std::decay_t<Derived>>::value;
// This should really be an inner class of limit_derived_target, without the T_limit template type,
// But the SUN CC 5.7 (not earlier versions) compiler finds it ambiguous when we specify a
@@ -63,10 +64,10 @@ struct limit_derived_target
using T_self = limit_derived_target<T_target, T_action>;
template <class T_type>
- void operator()(const T_type& _A_type) const
+ void operator()(T_type&& _A_type) const
{
with_type<is_base_of_or_same_v<T_target, T_type>,
- T_type, T_self>::execute_(_A_type, *this);
+ T_type, T_self>::execute_(std::forward<T_type>(_A_type), *this);
}
limit_derived_target(const T_action& _A_action) : action_(_A_action) {}
@@ -103,10 +104,10 @@ struct limit_derived_target<T_target*, T_action>
using T_self = limit_derived_target<T_target*, T_action>;
template <class T_type>
- void operator()(const T_type& _A_type) const
+ void operator()(T_type&& _A_type) const
{
with_type_pointer<is_base_of_or_same_v<T_target, T_type>,
- T_type, T_self>::execute_(_A_type, *this);
+ T_type, T_self>::execute_(std::forward<T_type>(_A_type), *this);
}
limit_derived_target(const T_action& _A_action) : action_(_A_action) {}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]