MCPcopy Create free account
hub / github.com/Gecode/gecode / realloc

Method realloc

gecode/support/heap.hpp:481–492  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

479
480 template<class T>
481 forceinline T*
482 Heap::realloc(T* b, long unsigned int n, long unsigned int m) {
483 if (n == m)
484 return b;
485 T* p = static_cast<T*>(ralloc(sizeof(T)*m));
486 for (long unsigned int i=0U; i<std::min(n,m); i++)
487 (void) new (p+i) T(b[i]);
488 for (long unsigned int i=n; i<m; i++)
489 (void) new (p+i) T();
490 free<T>(b,n);
491 return p;
492 }
493 template<class T>
494 forceinline T*
495 Heap::realloc(T* b, long int n, long int m) {

Callers 2

rreallocMethod · 0.45
resizeMethod · 0.45

Calls 1

minFunction · 0.50

Tested by

no test coverage detected