]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | // DEPRECATED in favor of adl_predestruct with deconstruct<T>(). |
2 | // A simple framework for creating objects with predestructors. | |
3 | // The objects must inherit from boost::signals2::predestructible, 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_PREDESTRUCTIBLE_HPP | |
16 | #define BOOST_SIGNALS2_PREDESTRUCTIBLE_HPP | |
17 | ||
18 | namespace boost | |
19 | { | |
20 | namespace signals2 | |
21 | { | |
22 | template<typename T> class predestructing_deleter; | |
23 | ||
24 | namespace predestructible_adl_barrier | |
25 | { | |
26 | class predestructible | |
27 | { | |
28 | protected: | |
29 | predestructible() {} | |
30 | public: | |
31 | template<typename T> | |
32 | friend void adl_postconstruct(const shared_ptr<T> &, ...) | |
33 | {} | |
34 | friend void adl_predestruct(predestructible *p) | |
35 | { | |
36 | p->predestruct(); | |
37 | } | |
38 | virtual ~predestructible() {} | |
39 | virtual void predestruct() = 0; | |
40 | }; | |
41 | } // namespace predestructible_adl_barrier | |
42 | using predestructible_adl_barrier::predestructible; | |
43 | } | |
44 | } | |
45 | ||
46 | #endif // BOOST_SIGNALS2_PREDESTRUCTIBLE_HPP |