1 | // |
---|---|
2 | // get_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/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_get_deleter( boost::shared_ptr<X> const & p ) |
21 | { |
22 | BOOST_TEST( boost::get_deleter<deleter>( p ) != 0 ); |
23 | } |
24 | |
25 | struct deleter |
26 | { |
27 | void operator()( X const * p ) { delete p; } |
28 | }; |
29 | |
30 | int main() |
31 | { |
32 | boost::shared_ptr<X> p( new X, deleter() ); |
33 | |
34 | test_get_deleter( p ); |
35 | |
36 | return boost::report_errors(); |
37 | } |
38 |