1 #ifndef QPID_INLINEALLOCATOR_H
2 #define QPID_INLINEALLOCATOR_H
27 #include <boost/type_traits/type_with_alignment.hpp>
28 #include <boost/type_traits/alignment_of.hpp>
32 template <
typename RequestedType,
typename InlineType,
typename BaseAllocator,
size_t Max>
40 template <
class BaseAllocator,
size_t Max>
43 typedef typename BaseAllocator::pointer
pointer;
44 typedef typename BaseAllocator::size_type
size_type;
51 if (n <= Max && !allocated) {
53 return reinterpret_cast<value_type*
>(address());
56 return BaseAllocator::allocate(n, 0);
65 BaseAllocator::deallocate(p, n);
75 static const size_t ALIGNMENT=boost::alignment_of<value_type>::value;
76 typedef typename boost::type_with_alignment<ALIGNMENT>::type Aligner;
89 template <
typename RequestedType,
typename InlineType,
typename BaseAllocator,
size_t Max>
91 typedef typename BaseAllocator::template rebind<RequestedType>::other
other;
94 template <
typename T,
typename BaseAllocator,
size_t Max>
BaseAllocator::template rebind< RequestedType >::other other
pointer allocate(size_type n)
InlineRebind< T1, value_type, BaseAllocator, Max >::other other
void deallocate(pointer p, size_type n)
qpid::InlineAllocator< BaseAllocator, Max > other
BaseAllocator::size_type size_type
BaseAllocator::value_type value_type
An allocator that has inline storage for up to Max objects of type BaseAllocator::value_type.
BaseAllocator::pointer pointer
InlineAllocator(const InlineAllocator &x)