Added missing Signal constructor taking const-qualified member functions.
This commit is contained in:
parent
573c431dbd
commit
1cbd435fbf
@ -64,6 +64,8 @@ public:
|
||||
inline token_t connect(THandler handler, Oneshot oneshot = Oneshot::NO, std::weak_ptr<TWeak> referenced = std::weak_ptr<TWeak>()) MIJIN_NOEXCEPT;
|
||||
template<typename TObject, typename TWeak = void>
|
||||
inline token_t connect(TObject& object, void (TObject::* handler)(TArgs...), Oneshot oneshot = Oneshot::NO, std::weak_ptr<TWeak> referenced = std::weak_ptr<TWeak>()) MIJIN_NOEXCEPT;
|
||||
template<typename TObject, typename TWeak = void>
|
||||
inline token_t connect(TObject& object, void (TObject::* handler)(TArgs...) const, Oneshot oneshot = Oneshot::NO, std::weak_ptr<TWeak> referenced = std::weak_ptr<TWeak>()) MIJIN_NOEXCEPT;
|
||||
inline void disconnect(token_t token) MIJIN_NOEXCEPT;
|
||||
|
||||
template<typename... TArgs2>
|
||||
@ -114,6 +116,26 @@ inline auto BaseSignal<TAllocator, TArgs...>::connect(TObject& object, void (TOb
|
||||
return nextToken++;
|
||||
}
|
||||
|
||||
template<template<typename> typename TAllocator, typename... TArgs>
|
||||
template<typename TObject, typename TWeak>
|
||||
inline auto BaseSignal<TAllocator, TArgs...>::connect(TObject& object, void (TObject::* handler)(TArgs...) const, Oneshot oneshot, std::weak_ptr<TWeak> referenced) MIJIN_NOEXCEPT -> token_t
|
||||
{
|
||||
std::lock_guard lock(handlersMutex_);
|
||||
|
||||
auto callable = [object = &object, handler](TArgs... args)
|
||||
{
|
||||
std::invoke(handler, object, std::forward<TArgs>(args)...);
|
||||
};
|
||||
handlers_.push_back({
|
||||
.callable = std::move(callable),
|
||||
.referenced = std::move(referenced),
|
||||
.token = nextToken,
|
||||
.oneshot = oneshot
|
||||
});
|
||||
|
||||
return nextToken++;
|
||||
}
|
||||
|
||||
template<template<typename> typename TAllocator, typename... TArgs>
|
||||
inline void BaseSignal<TAllocator, TArgs...>::disconnect(token_t token) MIJIN_NOEXCEPT
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user