74 static_assert(!std::is_same<T, bool>::value,
75 "Since Array wraps std::vector, bool is not allowed to avoid unallowed behavior");
92 assert(n >= 0 && n <
int(
data.capacity()));
98 assert(n >= 0 && n <
int(
data.capacity()));
148 data.insert(
data.begin() + i - 1, n, newt);
156 data.insert(
data.begin() + i - 1, n, t);
165 data.insert(
data.begin() + i - 1, t, t + n);
181 assert(n <
size() && n >= 0);
202 return int(
data.size());
208 data.resize(newsize);
231 data = std::move(rhs.data);
Safe arrays of arbitrary types.
Array & operator=(const Array &&rhs)
Array(const Array &old)
copy constructor
bool isConsistent() const
Consistency check.
T & operator[](int n)
reference n 'th element.
void append(int n, const T t[])
append n elements from t.
void append(int n)
append n uninitialized elements.
Array< T > & operator=(const Array< T > &rhs)
assignment operator.
const T * get_const_ptr() const
get a const C pointer to the data.
void insert(int i, int n, const T &t)
insert n elements with value t before i 'the element.
void push_back(const T &val)
void insert(int i, int n)
insert n uninitialized elements before i 'th element.
void reSize(int newsize)
reset the number of elements.
void append(const T &t)
append 1 elements with value t.
void clear()
remove all elements.
Array(int n=0)
default constructor.
void insert(int i, const Array< T > &t)
insert all elements from p_array before i 'th element.
const T & operator[](int n) const
reference n 'th element.
void insert(int i, int n, const T t[])
insert n elements from p_array before i 'th element.
void remove(int n=0, int m=1)
remove m elements starting at n.
void append(int n, const T &t)
append n elements with value t.
int size() const
return the number of elements.
void append(const Array< T > &t)
append all elements from p_array.
Everything should be within this namespace.
Memory allocation routines.