]>
Commit | Line | Data |
---|---|---|
1 | [/ | |
2 | / Copyright (c) 2014 Andrey Semashev | |
3 | / | |
4 | / Distributed under the Boost Software License, Version 1.0. (See accompanying | |
5 | / file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) | |
6 | /] | |
7 | ||
8 | [section:null_deleter null_deleter] | |
9 | ||
10 | [simplesect Authors] | |
11 | ||
12 | * Andrey Semashev | |
13 | ||
14 | [endsimplesect] | |
15 | ||
16 | [section Header <boost/core/null_deleter.hpp>] | |
17 | ||
18 | The header `<boost/core/null_deleter.hpp>` defines the `boost::null_deleter` function object, | |
19 | which can be used as a deleter with smart pointers such as `unique_ptr` or `shared_ptr`. The | |
20 | deleter doesn't do anything with the pointer provided upon deallocation, which makes it useful | |
21 | when the pointed object is deallocated elsewhere. | |
22 | ||
23 | [section Example] | |
24 | `` | |
25 | std::shared_ptr< std::ostream > make_stream() | |
26 | { | |
27 | return std::shared_ptr< std::ostream >(&std::cout, boost::null_deleter()); | |
28 | } | |
29 | `` | |
30 | [endsect] | |
31 | ||
32 | [endsect] | |
33 | ||
34 | [endsect] |