comparison DEPENDENCIES/generic/include/boost/signals2/trackable.hpp @ 101:c530137014c0

Update Boost headers (1.58.0)
author Chris Cannam
date Mon, 07 Sep 2015 11:12:49 +0100
parents 2665513ce2d3
children
comparison
equal deleted inserted replaced
100:793467b5e61c 101:c530137014c0
16 #ifndef BOOST_SIGNALS2_TRACKABLE_HPP 16 #ifndef BOOST_SIGNALS2_TRACKABLE_HPP
17 #define BOOST_SIGNALS2_TRACKABLE_HPP 17 #define BOOST_SIGNALS2_TRACKABLE_HPP
18 18
19 #include <boost/assert.hpp> 19 #include <boost/assert.hpp>
20 #include <boost/shared_ptr.hpp> 20 #include <boost/shared_ptr.hpp>
21 #include <boost/weak_ptr.hpp>
21 22
22 namespace boost { 23 namespace boost {
23 namespace signals2 { 24 namespace signals2 {
24 namespace detail 25 namespace detail
25 { 26 {
26 class tracked_objects_visitor; 27 class tracked_objects_visitor;
28
29 // trackable_pointee is used to identify the tracked shared_ptr
30 // originating from the signals2::trackable class. These tracked
31 // shared_ptr are special in that we shouldn't bother to
32 // increment their use count during signal invocation, since
33 // they don't actually control the lifetime of the
34 // signals2::trackable object they are associated with.
35 class trackable_pointee
36 {};
27 } 37 }
28 class trackable { 38 class trackable {
29 protected: 39 protected:
30 trackable(): _tracked_ptr(static_cast<int*>(0)) {} 40 trackable(): _tracked_ptr(static_cast<detail::trackable_pointee*>(0)) {}
31 trackable(const trackable &): _tracked_ptr(static_cast<int*>(0)) {} 41 trackable(const trackable &): _tracked_ptr(static_cast<detail::trackable_pointee*>(0)) {}
32 trackable& operator=(const trackable &) 42 trackable& operator=(const trackable &)
33 { 43 {
34 return *this; 44 return *this;
35 } 45 }
36 ~trackable() {} 46 ~trackable() {}
37 private: 47 private:
38 friend class detail::tracked_objects_visitor; 48 friend class detail::tracked_objects_visitor;
39 const shared_ptr<void>& get_shared_ptr() const 49 weak_ptr<detail::trackable_pointee> get_weak_ptr() const
40 { 50 {
41 return _tracked_ptr; 51 return _tracked_ptr;
42 } 52 }
43 53
44 shared_ptr<void> _tracked_ptr; 54 shared_ptr<detail::trackable_pointee> _tracked_ptr;
45 }; 55 };
46 } // end namespace signals2 56 } // end namespace signals2
47 } // end namespace boost 57 } // end namespace boost
48 58
49 #endif // BOOST_SIGNALS2_TRACKABLE_HPP 59 #endif // BOOST_SIGNALS2_TRACKABLE_HPP