71 T*
alloc(
long unsigned int n);
87 T*
alloc(
unsigned int n);
103 void free(T*
b,
long unsigned int n);
111 void free(T* b,
long int n);
119 void free(T* b,
unsigned int n);
127 void free(T* b,
int n);
140 T*
realloc(T* b,
long unsigned int n,
long unsigned int m);
153 T*
realloc(T* b,
long int n,
long int m);
166 T*
realloc(T* b,
unsigned int n,
unsigned int m);
179 T*
realloc(T* b,
int n,
int m);
188 T**
realloc(T** b,
long unsigned int n,
long unsigned int m);
197 T**
realloc(T** b,
long int n,
long int m);
206 T**
realloc(T** b,
unsigned int n,
unsigned int m);
215 T**
realloc(T** b,
int n,
int m);
225 static T*
copy(T*
d,
const T* s,
long unsigned int n);
235 static T*
copy(T* d,
const T* s,
long int n);
245 static T*
copy(T* d,
const T* s,
unsigned int n);
255 static T*
copy(T* d,
const T* s,
int n);
264 static T**
copy(T** d,
const T** s,
long unsigned int n);
273 static T**
copy(T** d,
const T** s,
long int n);
282 static T**
copy(T** d,
const T** s,
unsigned int n);
291 static T**
copy(T** d,
const T** s,
int n);
300 void rfree(
void* p,
size_t s);
306 static void*
operator new(
size_t s)
throw() { (void) s;
return NULL; }
308 static void operator delete(
void* p) { (void) p; };
312 const Heap& operator =(
const Heap&) {
return *
this; }
324 void* p = ::malloc(s);
343 if (p != NULL || s == 0)
356 T* p =
static_cast<T*
>(
ralloc(
sizeof(T)*n));
357 for (
long unsigned int i=n;
i--; )
358 (
void)
new (p+
i) T();
365 return alloc<T>(
static_cast<long unsigned int>(n));
370 return alloc<T>(
static_cast<long unsigned int>(n));
376 return alloc<T>(
static_cast<long unsigned int>(n));
382 for (
long unsigned int i=n;
i--; )
390 free<T>(
b,
static_cast<long unsigned int>(n));
395 free<T>(
b,
static_cast<long unsigned int>(n));
401 free<T>(
b,
static_cast<long unsigned int>(n));
409 T* p =
static_cast<T*
>(
ralloc(
sizeof(T)*m));
410 for (
long unsigned int i=
std::min(n,m);
i--; )
411 (
void)
new (p+
i) T(b[
i]);
412 for (
long unsigned int i=n; i<
m; i++)
413 (
void)
new (p+
i) T();
420 assert((n >= 0) && (m >= 0));
421 return realloc<T>(
b,
static_cast<long unsigned int>(n),
422 static_cast<long unsigned int>(m));
427 return realloc<T>(
b,
static_cast<long unsigned int>(n),
428 static_cast<long unsigned int>(m));
433 assert((n >= 0) && (m >= 0));
434 return realloc<T>(
b,
static_cast<long unsigned int>(n),
435 static_cast<long unsigned int>(m));
438 #define GECODE_SUPPORT_REALLOC(T) \
441 Heap::realloc<T>(T* b, long unsigned int, long unsigned int m) { \
442 return static_cast<T*>(rrealloc(b,m*sizeof(T))); \
446 Heap::realloc<T>(T* b, long int n, long int m) { \
447 assert((n >= 0) && (m >= 0)); \
448 return realloc<T>(b,static_cast<long unsigned int>(n), \
449 static_cast<long unsigned int>(m)); \
453 Heap::realloc<T>(T* b, unsigned int n, unsigned int m) { \
454 return realloc<T>(b,static_cast<long unsigned int>(n), \
455 static_cast<long unsigned int>(m)); \
459 Heap::realloc<T>(T* b, int n, int m) { \
460 assert((n >= 0) && (m >= 0)); \
461 return realloc<T>(b,static_cast<long unsigned int>(n), \
462 static_cast<long unsigned int>(m)); \
477 #undef GECODE_SUPPORT_REALLOC
482 return static_cast<T**
>(
rrealloc(b,m*
sizeof(T*)));
487 assert((n >= 0) && (m >= 0));
488 return realloc<T*>(
b,
static_cast<long unsigned int>(n),
489 static_cast<long unsigned int>(m));
494 return realloc<T*>(
b,
static_cast<long unsigned int>(n),
495 static_cast<long unsigned int>(m));
500 assert((n >= 0) && (m >= 0));
501 return realloc<T*>(
b,
static_cast<long unsigned int>(n),
502 static_cast<long unsigned int>(m));
508 for (
long unsigned int i=n;
i--; )
516 return copy<T>(
d,s,
static_cast<long unsigned int>(n));
521 return copy<T>(
d,s,
static_cast<long unsigned int>(n));
527 return copy<T>(
d,s,
static_cast<long unsigned int>(n));
530 #define GECODE_SUPPORT_COPY(T) \
533 Heap::copy(T* d, const T* s, long unsigned int n) { \
534 return static_cast<T*>(memcpy(d,s,n*sizeof(T))); \
538 Heap::copy(T* d, const T* s, long int n) { \
540 return copy<T>(d,s,static_cast<long unsigned int>(n)); \
544 Heap::copy(T* d, const T* s, unsigned int n) { \
545 return copy<T>(d,s,static_cast<long unsigned int>(n)); \
549 Heap::copy(T* d, const T* s, int n) { \
551 return copy<T>(d,s,static_cast<long unsigned int>(n)); \
566 #undef GECODE_SUPPORT_COPY
571 return static_cast<T**
>(memcpy(d,s,n*
sizeof(T*)));
577 return copy<T*>(
d,s,
static_cast<long unsigned int>(n));
582 return copy<T*>(
d,s,
static_cast<long unsigned int>(n));
588 return copy<T*>(
d,s,
static_cast<long unsigned int>(n));