23 #ifndef SIMPLE_OBJECT_POOL_H_ 24 #define SIMPLE_OBJECT_POOL_H_ 26 #include <boost/pool/pool.hpp> 38 class Simple_object_pool :
protected boost::pool<boost::default_user_allocator_malloc_free> {
40 typedef boost::pool<boost::default_user_allocator_malloc_free> Base;
47 Base
const& base()
const {
52 typedef T element_type;
53 typedef boost::default_user_allocator_malloc_free user_allocator;
54 typedef typename Base::size_type size_type;
55 typedef typename Base::difference_type difference_type;
58 Simple_object_pool(U&&...u) : Base(sizeof (T), std::forward<U>(u)...) { }
61 pointer construct(U&&...u) {
62 void* p = base().malloc BOOST_PREVENT_MACRO_SUBSTITUTION();
65 new(p) T(std::forward<U>(u)...);
67 base().free BOOST_PREVENT_MACRO_SUBSTITUTION(p);
70 return static_cast<pointer
> (p);
73 void destroy(pointer p) {
75 base().free BOOST_PREVENT_MACRO_SUBSTITUTION(p);
81 #endif // SIMPLE_OBJECT_POOL_H_ Definition: SimplicialComplexForAlpha.h:26