For this assignment you will be implementing a Dynamic Array capable of accepting any primitive type.
#pragma once
#include <memory>
template <class T> class Vec {
public:
typedef T* iterator;
typedef const T* const_iterator;
typedef size_t size_type;
typedef T value_type;
Vec();
explicit Vec(size_type n, const T& t = T());
Vec(const Vec& v);
Vec& operator=(const Vec&);
~Vec()
T& operator[](size_type i)
const T& operator[](size_type i) const;
void push_back(const T& t);
void push_front(const T& t);
const T pop_back();
const T pop_front();
size_type size() const;
// Iterators
iterator begin();
const_iterator begin();
iterator end();
const_iterator end() const;
// Clear the vector
void clear();
bool empty() const;
void erase(iterator position);
void remove(const T& t);
private:
iterator data;
iterator size;
iterator capacity;
// facilities for memory allocation
std::allocator<T> alloc;
};
This assignment will be hosted on Github Classroom.
cd ..
)git clone <your repository link here>
)Array
)Array.hpp
(Copy and paste the header content from above)Array.test.cpp
(Refer to other test files for guidance)Array.cpp
git add . && git commit -m "Done" && git push
Criteria | Points |
---|---|
Functional Correctness | 90 |
Quality | 10 |
Submissions are handled by Github Classroom. Submissions after the deadline are not graded.