diff options
author | Murray Cumming <murrayc@murrayc.com> | 2016-03-03 11:49:16 +0100 |
---|---|---|
committer | Murray Cumming <murrayc@murrayc.com> | 2016-03-03 12:08:09 +0100 |
commit | faa27446a1373462f864168787e1f03b3f5f317e (patch) | |
tree | 777687795726e2d82b7dc3b95efb5c456d7ce7f6 | |
parent | 6de9eacd24a5b9e03b900dda16f94d2b1c858f4b (diff) | |
download | sigc++-faa27446a1373462f864168787e1f03b3f5f317e.tar.gz |
slot_rep::dup(): Take a slot_rep* instead of void*.
-rw-r--r-- | sigc++/functors/slot.h | 5 | ||||
-rw-r--r-- | 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() |