1 /* Copyright (C) 2011 Kwan Ting Chan
2 * Based from bug report submitted by Xiaohan Wang
4 * Use, modification and distribution is subject to the
5 * Boost Software License, Version 1.0. (See accompanying
6 * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
9 // Test of bug #4960 (https://svn.boost.org/trac/boost/ticket/4960)
11 #include <boost/pool/pool_alloc.hpp>
15 typedef std::vector
<int, boost::pool_allocator
<int> > EventVector
;
16 typedef std::vector
<EventVector
, boost::pool_allocator
<EventVector
> > IndexVector
;
22 for (int i
= 0; i
< limit
; ++i
)
24 iv
.push_back(EventVector());
25 for(int j
= 0; j
< limit
; ++j
)
26 iv
.back().push_back(j
);
29 boost::pool
<boost::default_user_allocator_new_delete
> po(4);
30 for(int i
= 0; i
< limit
; ++i
)
32 void* p
= po
.ordered_malloc(0);
33 po
.ordered_free(p
, 0);
36 boost::pool_allocator
<int> al
;
37 for(int i
= 0; i
< limit
; ++i
)
39 int* p
= al
.allocate(0);
43 std::cout
<< "it works\n";