1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
| template<typename T>
class vector {
public:
using iterator = typename std::vector<T>::iterator;
using const_iterator = typename std::vector<T>::const_iterator;
private:
std::vector<T> data;
public:
vector(size_t const count);
vector(size_t const count, T const & val);
size_t size() const { return data.size(); };
T & operator[](size_t const id);
T const & operator[](size_t const id) const;
iterator begin() { return data.begin(); };
iterator end() { return data.end(); };
const_iterator cbegin() const { return data.cbegin(); };
const_iterator cend() const { return data.cend(); };
void push(T const & val);
void pop();
void clear();
// OPERATORS
vector<T> & operator=(vector<T> const & src);
vector<T> & operator=(T const & src);
vector<T> & operator+=(vector<T> const & src);
vector<T> & operator+=(T const & src);
vector<T> & operator-=(vector<T> const & src);
vector<T> & operator-=(T const & src);
vector<T> & operator*=(vector<T> const & src);
vector<T> & operator*=(T const & src);
vector<T> & operator/=(vector<T> const & src);
vector<T> & operator/=(T const & src);
bool operator==(vector<T> const & src) const;
bool operator!=(vector<T> const & src) const;
}; |