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

Method resize

gecode/kernel/data/array.hpp:1522–1536  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1520
1521 template<class T>
1522 forceinline void
1523 ArgArrayBase<T>::resize(int i) {
1524 if (n+i >= capacity) {
1525 assert(n+i >= onstack_size);
1526 int newCapacity = (3*capacity)/2;
1527 if (newCapacity <= n+i)
1528 newCapacity = n+i;
1529 T* newA = allocate(newCapacity);
1530 heap.copy<T>(newA,a,n);
1531 if (capacity > onstack_size)
1532 heap.free(a,capacity);
1533 capacity = newCapacity;
1534 a = newA;
1535 }
1536 }
1537
1538 template<class T>
1539 forceinline

Callers

nothing calls this directly

Calls 1

freeMethod · 0.45

Tested by

no test coverage detected