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