58 static inline int imax(
int x,
int y )
60 int mask = (y - x) >> (
sizeof(
int) * 8 - 1);
61 return (x & mask) + (y & (~mask));
67 cap += ((
cap >> 1) + 2) & ~1;
107 _toMove.moveTo( *
this );
125 assert( nelems <=
sz );
126 for(
int i = 0; i < nelems; i++ )
132 assert( nelems <=
sz );
204 for(
int i = 0; i <
sz; i++ )
223 for (
int i = 0; i < v.
size(); i++) {
224 if (i > 0) os <<
", ";
233 for (
int i = 0; i < v.
size(); i++) {
234 if (i > 0) os <<
", ";
235 os << static_cast<int>(v[i]);
245 int add = imax( (min_cap - cap + 1) & ~1, ((cap >> 1) + 2) & ~1 );
246 if( (add > INT_MAX - cap || ((data = (T*)::realloc( data, (
unsigned)(cap += add) *
sizeof(T) )) == NULL)) && errno == ENOMEM )
256 for(
int i = sz; i < size; i++ )
267 for(
int i = sz; i < size; i++ )
277 for(
int i = 0; i < sz; i++ )
281 free( data ), data = NULL, cap = 0;
static int imax(int x, int y)
const T & operator[](int index) const
void push_(const T &elem)
static void nextCap(int &cap)
void copyTo(vec< T > ©) const
void moveTo(vec< T > &dest)
vec< T > & operator=(vec< T > &)
const T & last(void) const
vec(int size, const T &pad)
void clear(bool dealloc=false)
void capacity(int min_cap)
void growTo(int size, const T &pad)
static void copy(const T &from, T &to)
std::ostream & operator<<(std::ostream &os, const Lit &l)