37#ifndef G4EnhancedVecAllocator_h
38#define G4EnhancedVecAllocator_h 1
75 template<
typename _Tp1>
81 : std::allocator<_Tp>() {;}
83 template<
typename _Tp1>
85 : std::allocator<_Tp>() {;}
93 _Tp*
allocate(
size_t _Count,
void *
const hint = 0);
107template<
typename _Tp>
128 if ( (chunk.
preAllocated[k]).address == ((
char *) _Ptr))
142template<
typename _Tp>
145template<
typename _Tp>
149 size_t totalsize = _Count *
sizeof(_Tp);
196 char *newSpace1 = (
char *) malloc(totalsize * 512);
201 for (
auto k = 0; k < 512 ; ++k)
204 (chunk.
preAllocated[k]).address = newSpace1+totalsize*k;
234 char *newSpace = (
char *) malloc(totalsize * 512);
239 for (
auto k = 0; k < 512 ; ++k)
241 (chunk.
preAllocated[originalchunknumber+k]).isAllocated = 0;
242 (chunk.
preAllocated[originalchunknumber+k]).address = newSpace+totalsize*k;
245 (chunk.
preAllocated[originalchunknumber]).isAllocated = 1;
247 return (_Tp*)((chunk.
preAllocated[originalchunknumber]).address);
254template<
typename _T1,
typename _T2>
263template<
typename _T1,
typename _T2>
G4bool operator!=(const G4EnhancedVecAllocator< _T1 > &, const G4EnhancedVecAllocator< _T2 > &)
G4bool operator==(const G4EnhancedVecAllocator< _T1 > &, const G4EnhancedVecAllocator< _T2 > &)
static G4ThreadLocal G4int totSpace
static G4ThreadLocal G4ChunkIndexType * allocStat
static G4ThreadLocal G4int numCat
_Tp * allocate(size_t _Count)
void deallocate(_Tp *_Ptr, size_t _Count)
~G4EnhancedVecAllocator()
G4EnhancedVecAllocator(const G4EnhancedVecAllocator< _Tp > &)
G4EnhancedVecAllocator(const G4EnhancedVecAllocator< _Tp1 > &)
G4ChunkType * preAllocated
G4EnhancedVecAllocator< _Tp1 > other