[libsigcplusplus] limit_derived_target(): Remove the specialization for pointer types.
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libsigcplusplus] limit_derived_target(): Remove the specialization for pointer types.
- Date: Fri, 15 Apr 2016 11:03:49 +0000 (UTC)
commit 080693391582a748cf92cad8f7962c6ab6f7166f
Author: Murray Cumming <murrayc murrayc com>
Date: Fri Apr 15 12:53:05 2016 +0200
limit_derived_target(): Remove the specialization for pointer types.
Now we always call visit_each_type() with trackable, not sometimes
trackable*.
sigc++/functors/slot.h | 12 ++++++------
sigc++/functors/slot_base.h | 6 +++---
sigc++/visit_each.h | 43 -------------------------------------------
3 files changed, 9 insertions(+), 52 deletions(-)
---
diff --git a/sigc++/functors/slot.h b/sigc++/functors/slot.h
index ca1a211..de97361 100644
--- a/sigc++/functors/slot.h
+++ b/sigc++/functors/slot.h
@@ -40,13 +40,13 @@ public:
inline typed_slot_rep(const T_functor& functor)
: slot_rep(nullptr, &destroy, &dup), functor_(functor)
{
- sigc::visit_each_type<trackable*>(slot_do_bind(this), functor_);
+ sigc::visit_each_type<trackable>(slot_do_bind(this), functor_);
}
inline typed_slot_rep(const typed_slot_rep& cl)
: slot_rep(cl.call_, &destroy, &dup), functor_(cl.functor_)
{
- sigc::visit_each_type<trackable*>(slot_do_bind(this), functor_);
+ sigc::visit_each_type<trackable>(slot_do_bind(this), functor_);
}
typed_slot_rep& operator=(const typed_slot_rep& src) = delete;
@@ -58,7 +58,7 @@ public:
{
call_ = nullptr;
destroy_ = nullptr;
- sigc::visit_each_type<trackable*>(slot_do_unbind(this), functor_);
+ sigc::visit_each_type<trackable>(slot_do_unbind(this), functor_);
}
private:
@@ -70,7 +70,7 @@ private:
self* self_ = static_cast<self*>(reinterpret_cast<slot_rep*>(data));
self_->call_ = nullptr;
self_->destroy_ = nullptr;
- sigc::visit_each_type<trackable*>(slot_do_unbind(self_), self_->functor_);
+ sigc::visit_each_type<trackable>(slot_do_unbind(self_), self_->functor_);
self_->functor_.~adaptor_type();
/* don't call disconnect() here: destroy() is either called
* a) from the parent itself (in which case disconnect() leads to a segfault) or
@@ -246,7 +246,7 @@ template <typename T_return, typename... T_arg>
struct visitor<slot<T_return, T_arg...>>
{
static void do_visit_each(
- const internal::limit_derived_target<trackable*, internal::slot_do_bind>& _A_action,
+ const internal::limit_derived_target<trackable, internal::slot_do_bind>& _A_action,
const slot<T_return, T_arg...>& _A_target)
{
if (_A_target.rep_ && _A_target.rep_->parent_ == nullptr)
@@ -254,7 +254,7 @@ struct visitor<slot<T_return, T_arg...>>
}
static void do_visit_each(
- const internal::limit_derived_target<trackable*, internal::slot_do_unbind>& _A_action,
+ const internal::limit_derived_target<trackable, internal::slot_do_unbind>& _A_action,
const slot<T_return, T_arg...>& _A_target)
{
if (_A_target.rep_ && _A_target.rep_->parent_ == _A_action.action_.rep_)
diff --git a/sigc++/functors/slot_base.h b/sigc++/functors/slot_base.h
index d6466f5..8bc5dc9 100644
--- a/sigc++/functors/slot_base.h
+++ b/sigc++/functors/slot_base.h
@@ -168,9 +168,9 @@ struct SIGC_API slot_do_bind
/** Adds a dependency to @p t.
* @param t The trackable object to add a callback to.
*/
- inline void operator()(const trackable* t) const
+ inline void operator()(const trackable& t) const
{
- t->add_destroy_notify_callback(rep_, &slot_rep::notify);
+ t.add_destroy_notify_callback(rep_, &slot_rep::notify);
}
};
@@ -188,7 +188,7 @@ struct SIGC_API slot_do_unbind
/** Removes a dependency from @p t.
* @param t The trackable object to remove the callback from.
*/
- inline void operator()(const trackable* t) const { t->remove_destroy_notify_callback(rep_); }
+ inline void operator()(const trackable& t) const { t.remove_destroy_notify_callback(rep_); }
};
} // namespace internal
diff --git a/sigc++/visit_each.h b/sigc++/visit_each.h
index 30aad54..71f3ab9 100644
--- a/sigc++/visit_each.h
+++ b/sigc++/visit_each.h
@@ -74,49 +74,6 @@ private:
};
};
-// Specialization for T_target pointer types, to provide a slightly different execute_()
-// implementation.
-
-template <class T_target, class T_action>
-struct limit_derived_target<T_target*, T_action>
-{
- template <class T_type>
- void operator()(T_type&& _A_type) const
- {
- using T_self = limit_derived_target<T_target*, T_action>;
-
- //Only call action_() if T_Target derives from T_Type.
- with_type_pointer<T_type, T_self>::execute_(std::forward<T_type>(_A_type), *this);
- }
-
- explicit limit_derived_target(const T_action& _A_action) : action_(_A_action) {}
-
- T_action action_;
-
-private:
- using target_type = T_target;
-
- template <class T_type, class T_limit, bool I_derived = is_base_of_or_same_v<typename
T_limit::target_type, T_type>>
- struct with_type_pointer;
-
- // Specialization for I_derived = false
- template <class T_type, class T_limit>
- struct with_type_pointer<T_type, T_limit, false>
- {
- static void execute_(const T_type&, const T_limit&) {}
- };
-
- // Specialization for I_derived = true
- template <class T_type, class T_limit>
- struct with_type_pointer<T_type, T_limit, true>
- {
- static void execute_(const T_type& _A_type, const T_limit& _A_action)
- {
- _A_action.action_(&_A_type);
- }
- };
-};
-
} /* namespace internal */
#endif // DOXYGEN_SHOULD_SKIP_THIS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]