1 | // |
---|---|
2 | // get_local_deleter_test2.cpp |
3 | // |
4 | // Copyright 2017 Peter Dimov |
5 | // |
6 | // Distributed under the Boost Software License, Version 1.0. (See |
7 | // accompanying file LICENSE_1_0.txt or copy at |
8 | // http://www.boost.org/LICENSE_1_0.txt) |
9 | // |
10 | |
11 | #include <boost/smart_ptr/local_shared_ptr.hpp> |
12 | #include <boost/core/lightweight_test.hpp> |
13 | |
14 | struct deleter; |
15 | |
16 | struct X |
17 | { |
18 | }; |
19 | |
20 | static void test_lsp_get_deleter( boost::local_shared_ptr<X> const & p ) |
21 | { |
22 | BOOST_TEST( boost::get_deleter<deleter>( p ) != 0 ); |
23 | } |
24 | |
25 | static void test_sp_get_deleter( boost::shared_ptr<X> const & p ) |
26 | { |
27 | BOOST_TEST( boost::get_deleter<deleter>( p ) != 0 ); |
28 | } |
29 | |
30 | struct deleter |
31 | { |
32 | void operator()( X const * p ) { delete p; } |
33 | }; |
34 | |
35 | int main() |
36 | { |
37 | boost::local_shared_ptr<X> p( new X, deleter() ); |
38 | |
39 | test_lsp_get_deleter( p ); |
40 | test_sp_get_deleter( p ); |
41 | |
42 | return boost::report_errors(); |
43 | } |
44 |