[libsigc++2/variadic_bind4] slot_rep::dup(): Take a slot_rep* instead of void*.
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libsigc++2/variadic_bind4] slot_rep::dup(): Take a slot_rep* instead of void*.
- Date: Thu, 3 Mar 2016 11:27:02 +0000 (UTC)
commit faa27446a1373462f864168787e1f03b3f5f317e
Author: Murray Cumming <murrayc murrayc com>
Date: Thu Mar 3 11:49:16 2016 +0100
slot_rep::dup(): Take a slot_rep* instead of void*.
sigc++/functors/slot.h | 5 ++---
sigc++/functors/slot_base.h | 7 +++++--
2 files changed, 7 insertions(+), 5 deletions(-)
---
diff --git a/sigc++/functors/slot.h b/sigc++/functors/slot.h
index ea793c7..dfbc4eb 100644
--- a/sigc++/functors/slot.h
+++ b/sigc++/functors/slot.h
@@ -74,10 +74,9 @@ struct typed_slot_rep : public slot_rep
* slot_rep object is registered in the referred trackables.
* @return A deep copy of the slot_rep object.
*/
- static void* dup(void* data)
+ static slot_rep* dup(slot_rep* a_rep)
{
- slot_rep* a_rep = reinterpret_cast<slot_rep*>(data);
- return static_cast<slot_rep*>(new self(*static_cast<self*>(a_rep)));
+ return new self(*static_cast<self*>(a_rep));
}
};
diff --git a/sigc++/functors/slot_base.h b/sigc++/functors/slot_base.h
index cd46cf3..ef7cf3d 100644
--- a/sigc++/functors/slot_base.h
+++ b/sigc++/functors/slot_base.h
@@ -63,6 +63,7 @@ struct SIGC_API slot_rep : public trackable
/* NB: Instead of slot_rep we could inherit slot_base from trackable.
* However, a simple benchmark seems to indicate that this slows
* down dereferencing of slot list iterators. Martin. */
+ //TODO: Try this now? murrayc.
/// Callback that invokes the contained functor.
/* This can't be a virtual function since number of arguments
@@ -77,10 +78,12 @@ struct SIGC_API slot_rep : public trackable
*/
func_destroy_notify destroy_;
+ typedef slot_rep* (*hook_dup)(slot_rep*);
+
/** Callback that makes a deep copy of the slot_rep object.
* @return A deep copy of the slot_rep object.
*/
- hook dup_;
+ hook_dup dup_;
/** Callback of parent_. */
func_destroy_notify cleanup_;
@@ -88,7 +91,7 @@ struct SIGC_API slot_rep : public trackable
/** Parent object whose callback cleanup_ is executed on notification. */
notifiable* parent_;
- inline slot_rep(hook call__, notifiable::func_destroy_notify destroy__, hook dup__) noexcept
+ inline slot_rep(hook call__, notifiable::func_destroy_notify destroy__, hook_dup dup__) noexcept
: call_(call__), destroy_(destroy__), dup_(dup__), cleanup_(nullptr), parent_(nullptr) {}
inline ~slot_rep()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]