48 static inline int imax (
int x,
int y) {
int mask = (y-x) >> (
sizeof(
int)*8-1);
return (x&
mask) + (y&(
~mask)); }
98 int add = imax((
min_cap - cap + 1) & ~1, ((cap >> 1) + 2) & ~1);
99 if (add >
INT_MAX - cap || (((data = (T*)::realloc(data, (cap += add) *
sizeof(T))) ==
nullptr) &&
errno ==
ENOMEM))
106 if (sz >= size)
return;
108 for (
int i = sz; i < size; i++) data[i] =
pad;
114 if (sz >= size)
return;
116 for (
int i = sz; i < size; i++)
new (&data[i]) T;
122 if (data !=
nullptr){
123 for (
int i = 0; i < sz; i++) data[i].~T();
125 if (
dealloc) free(data), data =
nullptr, cap = 0;
const T & operator[](int index) const
void growTo(int size, const T &pad)
static void nextCap(int &cap)
void clear(bool dealloc=false)
static int imax(int x, int y)
void moveTo(vec< T > &dest)
void capacity(int min_cap)
vec(int size, const T &pad)
vec< T > & operator=(vec< T > &other)
void copyTo(vec< T > ©) const
void push_(const T &elem)
const T & last(void) const
static MultilevelBuilder * getDoubleFactoredZeroAdjustedMerger()
static void copy(const T &from, T &to)