00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038 #ifndef __POOL_LIST_H
00039 #define __POOL_LIST_H
00040
00041 #include <list>
00042
00043 #ifdef ONIKIRI_USE_ONIKIRI_POOL_ALLOCATOR
00044 #include "pool_allocator.h"
00045 #define ONIKIRI_POOL_LIST_ALLOCATOR pool_allocator
00046 #else
00047 #include <boost/pool/pool_alloc.hpp>
00048 #define ONIKIRI_POOL_LIST_ALLOCATOR boost::fast_pool_allocator
00049 #endif
00050
00051 namespace Onikiri
00052 {
00053 template <typename T>
00054 class pool_list :
00055 public std::list<T, ONIKIRI_POOL_LIST_ALLOCATOR<T> >
00056 {
00057 typedef ONIKIRI_POOL_LIST_ALLOCATOR<T> allocator_type;
00058 typedef std::list<T, allocator_type > base_type;
00059
00060 public:
00061
00062 pool_list()
00063 : base_type()
00064 {
00065 }
00066
00067 explicit pool_list(
00068 const allocator_type& allocator
00069 ) :
00070 base_type(allocator)
00071 {
00072 }
00073
00074 explicit pool_list(
00075 size_t n,
00076 const T& value = T(),
00077 const allocator_type& allocator = allocator_type()
00078 ) :
00079 base_type(n, value, allocator)
00080 {
00081 };
00082
00083 template <class input_iterator>
00084 pool_list(
00085 input_iterator begin,
00086 input_iterator end,
00087 const allocator_type& allocator = allocator_type()
00088 ) :
00089 base_type(begin, end, allocator)
00090 {
00091 };
00092
00093 pool_list(const pool_list<T>& x)
00094 : base_type(x)
00095 {
00096 }
00097 };
00098
00099 };
00100
00101 #endif