Chris@16
|
1 //////////////////////////////////////////////////////////////////////////////
|
Chris@16
|
2 //
|
Chris@16
|
3 // Copyright (C) 2011-2013 Vicente J. Botet Escriba
|
Chris@16
|
4 //
|
Chris@16
|
5 // Distributed under the Boost Software License, Version 1.0. (See accompanying
|
Chris@16
|
6 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
Chris@16
|
7 //
|
Chris@16
|
8 // See http://www.boost.org/libs/thread for documentation.
|
Chris@16
|
9 //
|
Chris@16
|
10 //////////////////////////////////////////////////////////////////////////////
|
Chris@16
|
11
|
Chris@16
|
12 #ifndef BOOST_THREAD_DETAIL_MEMORY_HPP
|
Chris@16
|
13 #define BOOST_THREAD_DETAIL_MEMORY_HPP
|
Chris@16
|
14
|
Chris@16
|
15 #include <boost/config.hpp>
|
Chris@101
|
16
|
Chris@101
|
17 #include <boost/thread/csbl/memory/pointer_traits.hpp>
|
Chris@101
|
18 #include <boost/thread/csbl/memory/allocator_arg.hpp>
|
Chris@101
|
19 #include <boost/thread/csbl/memory/allocator_traits.hpp>
|
Chris@101
|
20 #include <boost/thread/csbl/memory/scoped_allocator.hpp>
|
Chris@16
|
21
|
Chris@16
|
22 namespace boost
|
Chris@16
|
23 {
|
Chris@16
|
24 namespace thread_detail
|
Chris@16
|
25 {
|
Chris@16
|
26 template <class _Alloc>
|
Chris@16
|
27 class allocator_destructor
|
Chris@16
|
28 {
|
Chris@101
|
29 typedef csbl::allocator_traits<_Alloc> alloc_traits;
|
Chris@16
|
30 public:
|
Chris@16
|
31 typedef typename alloc_traits::pointer pointer;
|
Chris@16
|
32 typedef typename alloc_traits::size_type size_type;
|
Chris@16
|
33 private:
|
Chris@16
|
34 _Alloc alloc_;
|
Chris@16
|
35 size_type s_;
|
Chris@16
|
36 public:
|
Chris@16
|
37 allocator_destructor(_Alloc& a, size_type s)BOOST_NOEXCEPT
|
Chris@16
|
38 : alloc_(a), s_(s)
|
Chris@16
|
39 {}
|
Chris@16
|
40 void operator()(pointer p)BOOST_NOEXCEPT
|
Chris@16
|
41 {
|
Chris@16
|
42 alloc_traits::destroy(alloc_, p);
|
Chris@16
|
43 alloc_traits::deallocate(alloc_, p, s_);
|
Chris@16
|
44 }
|
Chris@16
|
45 };
|
Chris@16
|
46 } //namespace thread_detail
|
Chris@101
|
47 }
|
Chris@16
|
48 #endif // BOOST_THREAD_DETAIL_MEMORY_HPP
|