Chris@16
|
1 // DEPRECATED in favor of adl_postconstruct with deconstruct<T>().
|
Chris@16
|
2 // A simple framework for creating objects with postconstructors.
|
Chris@16
|
3 // The objects must inherit from boost::signals2::postconstructible, and
|
Chris@16
|
4 // have their lifetimes managed by
|
Chris@16
|
5 // boost::shared_ptr created with the boost::signals2::deconstruct_ptr()
|
Chris@16
|
6 // function.
|
Chris@16
|
7 //
|
Chris@16
|
8 // Copyright Frank Mori Hess 2007-2008.
|
Chris@16
|
9 //
|
Chris@16
|
10 // Use, modification and
|
Chris@16
|
11 // distribution is subject to the Boost Software License, Version
|
Chris@16
|
12 // 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
Chris@16
|
13 // http://www.boost.org/LICENSE_1_0.txt)
|
Chris@16
|
14
|
Chris@16
|
15 #ifndef BOOST_SIGNALS2_POSTCONSTRUCTIBLE_HPP
|
Chris@16
|
16 #define BOOST_SIGNALS2_POSTCONSTRUCTIBLE_HPP
|
Chris@16
|
17
|
Chris@16
|
18 namespace boost
|
Chris@16
|
19 {
|
Chris@16
|
20 template<typename T> class shared_ptr;
|
Chris@16
|
21
|
Chris@16
|
22 namespace signals2
|
Chris@16
|
23 {
|
Chris@16
|
24 namespace postconstructible_adl_barrier
|
Chris@16
|
25 {
|
Chris@16
|
26 class postconstructible;
|
Chris@16
|
27 }
|
Chris@16
|
28 namespace detail
|
Chris@16
|
29 {
|
Chris@16
|
30 void do_postconstruct(const boost::signals2::postconstructible_adl_barrier::postconstructible *ptr);
|
Chris@16
|
31 } // namespace detail
|
Chris@16
|
32
|
Chris@16
|
33 namespace postconstructible_adl_barrier
|
Chris@16
|
34 {
|
Chris@16
|
35 class postconstructible
|
Chris@16
|
36 {
|
Chris@16
|
37 public:
|
Chris@16
|
38 friend void detail::do_postconstruct(const postconstructible *ptr);
|
Chris@16
|
39 template<typename T>
|
Chris@16
|
40 friend void adl_postconstruct(const shared_ptr<T> &sp, postconstructible *p)
|
Chris@16
|
41 {
|
Chris@16
|
42 p->postconstruct();
|
Chris@16
|
43 }
|
Chris@16
|
44 protected:
|
Chris@16
|
45 postconstructible() {}
|
Chris@16
|
46 virtual ~postconstructible() {}
|
Chris@16
|
47 virtual void postconstruct() = 0;
|
Chris@16
|
48 };
|
Chris@16
|
49 } // namespace postconstructible_adl_barrier
|
Chris@16
|
50 using postconstructible_adl_barrier::postconstructible;
|
Chris@16
|
51
|
Chris@16
|
52 }
|
Chris@16
|
53 }
|
Chris@16
|
54
|
Chris@16
|
55 #endif // BOOST_SIGNALS2_POSTCONSTRUCTIBLE_HPP
|