58 class Chunk :
public HeapAllocated {
69 bool alloc(
size_t s,
void*&
p);
137 T*
alloc(
long unsigned int n);
172 void free(T*
b,
long unsigned int n);
183 void free(T*
b,
long int n);
194 void free(T*
b,
unsigned int n);
218 T*
realloc(T*
b,
long unsigned int n,
long unsigned int m);
231 T*
realloc(T*
b,
long int n,
long int m);
244 T*
realloc(T*
b,
unsigned int n,
unsigned int m);
269 void rfree(
void*
p,
size_t s);
283 template<
class T,
typename A1>
290 template<
class T,
typename A1,
typename A2>
291 T&
construct(A1
const& a1, A2
const& a2);
297 template<
class T,
typename A1,
typename A2,
typename A3>
298 T&
construct(A1
const& a1, A2
const& a2, A3
const& a3);
304 template<
class T,
typename A1,
typename A2,
typename A3,
typename A4>
305 T&
construct(A1
const& a1, A2
const& a2, A3
const& a3, A4
const& a4);
311 template<
class T,
typename A1,
typename A2,
typename A3,
typename A4,
typename A5>
312 T&
construct(A1
const& a1, A2
const& a2, A3
const& a3, A4
const& a4, A5
const& a5);
318 static void*
operator new(
size_t s)
throw() { (void) s;
return NULL; }
320 static void operator delete(
void*
p) { (void)
p; };
324 const Region& operator =(
const Region&) {
return *
this; }
334 Region::Chunk::alloc(
size_t s,
void*&
p) {
341 p = ptr_cast<char*>(&area[0]) + free;
346 Region::Chunk::reset(
void) {
353 : chunk(pool().chunk()), hi(0) {}
363 if (chunk->alloc(s,
p))
366 return heap_alloc(s);
387 T*
p = static_cast<T*>(
ralloc(
sizeof(T)*
n));
388 for (
long unsigned int i=0U;
i<
n;
i++)
389 (
void)
new (
p+
i) T();
396 return alloc<T>(static_cast<long unsigned int>(
n));
401 return alloc<T>(static_cast<long unsigned int>(
n));
407 return alloc<T>(static_cast<long unsigned int>(
n));
413 for (
long unsigned int i=0U;
i<
n;
i++)
421 free<T>(
b,static_cast<long unsigned int>(
n));
426 free<T>(
b,static_cast<long unsigned int>(
n));
432 free<T>(
b,static_cast<long unsigned int>(
n));
439 T*
p = static_cast<T*>(
ralloc(
sizeof(T)*m));
440 for (
long unsigned int i=0U;
i<
n;
i++)
441 (
void)
new (
p+
i) T(
b[
i]);
442 for (
long unsigned int i=
n;
i<m;
i++)
443 (
void)
new (
p+
i) T();
454 assert((
n >= 0) && (m >= 0));
455 return realloc<T>(
b,static_cast<long unsigned int>(
n),
456 static_cast<long unsigned int>(m));
461 return realloc<T>(
b,static_cast<long unsigned int>(
n),
462 static_cast<long unsigned int>(m));
467 assert((
n >= 0) && (m >= 0));
468 return realloc<T>(
b,static_cast<long unsigned int>(
n),
469 static_cast<long unsigned int>(m));
481 template<
class T,
typename A1>
484 T&
t = *static_cast<T*>(
ralloc(
sizeof(T)));
488 template<
class T,
typename A1,
typename A2>
491 T&
t = *static_cast<T*>(
ralloc(
sizeof(T)));
495 template<
class T,
typename A1,
typename A2,
typename A3>
498 T&
t = *static_cast<T*>(
ralloc(
sizeof(T)));
499 new (&
t) T(a1,a2,a3);
502 template<
class T,
typename A1,
typename A2,
typename A3,
typename A4>
505 T&
t = *static_cast<T*>(
ralloc(
sizeof(T)));
506 new (&
t) T(a1,a2,a3,a4);
509 template<
class T,
typename A1,
typename A2,
typename A3,
typename A4,
typename A5>
512 T&
t = *static_cast<T*>(
ralloc(
sizeof(T)));
513 new (&
t) T(a1,a2,a3,a4,a5);