9 #ifndef _fei_Pool_alloc_hpp_
10 #define _fei_Pool_alloc_hpp_
12 #include "fei_macros.hpp"
13 #include "fei_Pool.hpp"
21 fei_Pool* get_fei_mem_pool(
size_t n);
41 typedef std::size_t size_type;
43 typedef const T* const_pointer;
45 typedef const T& const_reference;
46 typedef std::ptrdiff_t difference_type;
55 pointer address (reference value)
const
59 const_pointer address (const_reference value)
const
71 pointer allocate(size_type n, const
void* hint = NULL);
72 void deallocate(pointer p, size_type n);
74 template<typename U>
void construct(U* p, const U& val)
77 void construct(pointer p,
const T& val)
80 template<
typename U>
void destroy(U* p)
83 void destroy(pointer p)
86 size_type max_size()
const throw() {
return std::numeric_limits<size_type>::max(); }
98 if (n==0)
return NULL;
102 mem = get_fei_mem_pool(n_*
sizeof(T));
106 std::cerr <<
"fei_Pool_alloc ERROR, allocate given bad length ("<<n
107 <<
"), must be " <<n_<<
". throwing exception."<<std::endl;
108 throw std::bad_alloc();
110 return static_cast<T*
>(mem->alloc());
116 if (p == NULL || n == 0)
return;
123 std::cerr <<
"fei_Pool_alloc ERROR, deallocate given bad length ("<<n
124 <<
"), must be " <<n_<<
". aborting."<<std::endl;
bool operator==(const SharedPtr< T > &a, const SharedPtr< U > &b)
bool operator!=(const SharedPtr< T > &a, const SharedPtr< U > &b)