1 | Index: boost/thread/detail/memory.hpp
|
---|
2 | ===================================================================
|
---|
3 | --- boost/thread/detail/memory.hpp (revision 80450)
|
---|
4 | +++ boost/thread/detail/memory.hpp (working copy)
|
---|
5 | @@ -33,7 +33,7 @@
|
---|
6 | typedef typename alloc_traits::pointer pointer;
|
---|
7 | typedef typename alloc_traits::size_type size_type;
|
---|
8 | private:
|
---|
9 | - _Alloc& alloc_;
|
---|
10 | + _Alloc alloc_;
|
---|
11 | size_type s_;
|
---|
12 | public:
|
---|
13 | allocator_destructor(_Alloc& a, size_type s)BOOST_NOEXCEPT
|
---|
14 | @@ -41,6 +41,7 @@
|
---|
15 | {}
|
---|
16 | void operator()(pointer p)BOOST_NOEXCEPT
|
---|
17 | {
|
---|
18 | + alloc_traits::destroy(alloc_, p);
|
---|
19 | alloc_traits::deallocate(alloc_, p, s_);
|
---|
20 | }
|
---|
21 | };
|
---|
22 | Index: libs/thread/test/sync/futures/packaged_task/alloc_ctor_pass.cpp
|
---|
23 | ===================================================================
|
---|
24 | --- libs/thread/test/sync/futures/packaged_task/alloc_ctor_pass.cpp (revision 80450)
|
---|
25 | +++ libs/thread/test/sync/futures/packaged_task/alloc_ctor_pass.cpp (working copy)
|
---|
26 | @@ -44,20 +44,27 @@
|
---|
27 | BOOST_THREAD_COPYABLE_AND_MOVABLE(A)
|
---|
28 | static int n_moves;
|
---|
29 | static int n_copies;
|
---|
30 | + static int n_instances;
|
---|
31 | + static int n_destroy;
|
---|
32 |
|
---|
33 | explicit A(long i) : data_(i)
|
---|
34 | {
|
---|
35 | + ++n_instances;
|
---|
36 | }
|
---|
37 | A(BOOST_THREAD_RV_REF(A) a) : data_(BOOST_THREAD_RV(a).data_)
|
---|
38 | {
|
---|
39 | + ++n_instances;
|
---|
40 | ++n_moves; BOOST_THREAD_RV(a).data_ = -1;
|
---|
41 | }
|
---|
42 | A(const A& a) : data_(a.data_)
|
---|
43 | {
|
---|
44 | + ++n_instances;
|
---|
45 | ++n_copies;
|
---|
46 | }
|
---|
47 | ~A()
|
---|
48 | {
|
---|
49 | + --n_instances;
|
---|
50 | + ++n_destroy;
|
---|
51 | }
|
---|
52 |
|
---|
53 | long operator()() const
|
---|
54 | @@ -68,6 +75,8 @@
|
---|
55 |
|
---|
56 | int A::n_moves = 0;
|
---|
57 | int A::n_copies = 0;
|
---|
58 | +int A::n_instances = 0;
|
---|
59 | +int A::n_destroy = 0;
|
---|
60 |
|
---|
61 | int main()
|
---|
62 | {
|
---|
63 | @@ -83,6 +92,8 @@
|
---|
64 | }
|
---|
65 | BOOST_TEST(A::n_copies == 0);
|
---|
66 | BOOST_TEST(A::n_moves > 0);
|
---|
67 | + BOOST_TEST(A::n_instances == 0);
|
---|
68 | + BOOST_TEST(A::n_destroy > 0);
|
---|
69 | BOOST_TEST(test_alloc_base::count == 0);
|
---|
70 | A::n_copies = 0;
|
---|
71 | A::n_copies = 0;
|
---|