5 # ifndef VCCC_SIGNAL_SLOT_H_
6 # define VCCC_SIGNAL_SLOT_H_
15 template<
typename Func>
18 template<
typename R,
typename ...Args>
22 using function = std::function<R(Args...)>;
31 template<
typename Func>
37 locked.reserve(tracked_objects_.size());
39 for(
const auto& w : tracked_objects_)
40 locked.emplace_back(w.lock());
45 for(
const auto& w : tracked_objects_)
51 template<
typename ...U>
53 return func_(std::forward<U>(args)...);
56 template<
typename ...U>
58 return func_(std::forward<U>(args)...);
63 tracked_objects_.emplace_back(target);
68 tracked_objects_.emplace_back(target);
74 weak_container tracked_objects_;
slot & track(std::weak_ptr< void > target)
Definition: slot.h:67
R operator()(U &&... args) const
Definition: slot.h:52
std::vector< std::shared_ptr< void > > locked_container
Definition: slot.h:24
locked_container lock() const
Definition: slot.h:35
R operator()(U &&... args)
Definition: slot.h:57
slot & operator=(slot &&)=default
R return_type
Definition: slot.h:21
bool expired() const
Definition: slot.h:44
slot(const Func &func)
Definition: slot.h:32
std::vector< std::weak_ptr< void > > weak_container
Definition: slot.h:23
slot & track(const std::shared_ptr< T > target)
Definition: slot.h:62
slot(slot const &)=default
slot & operator=(slot const &)=default
Definition: directory.h:12