Vector: a std::vector
class
Due: June 4, 2019 @ 6:00PM
Grab the handout tarfile from here: http://cs.millersville.edu/~wkillian/2019/summer/files/csci362/lab2b-vector.tar
I have given you a somewhat incomplete implementation of Vector
. Vector
is almost exactly like std::vector
but with a few minor differences we won't really care or worry about. You are tasked with implementing several member functions.
This is not a small file! I'm giving you 500+ lines of code and you'll be adding to it. It's easy to become overwhelmed --- so I'm providing you a "path toward success".
Vector
, you can always write code and compare it to what happens when you use std::vector
// constructors, destructors, special functions
template <typename InputIterator>
Vector (InputIterator first, InputIterator last);
Vector (Vector const& other);
~Vector ();
Vector& operator= (Vector const& other);
Vector& operator= (Vector&& other);
Vector& operator= (std::initializer_list<T> ilist);
void assign (size_type count, T const& value);
// access
reference operator[] (size_type pos);
const_reference operator[] (size_type pos) const;
reference back();
const_reference back();
// iterators
iterator begin() noexcept;
const_iterator begin() const noexcept;
iterator end() noexcept;
const_iterator end() const noexcept;
// size/capacity operations
bool empty() const noexcept;
size_type capacity() const noexcept;
void shrink_to_fit();
// mutator functions
// NOTE: not part of std::vector
iterator impl_safe_iterator (const_iterator pos, size_type elements = 1);
void clear();
iterator erase (const_iterator pos);
iterator erase (const_iterator first, const_iterator last);
void push_back (T const& value);
void push_back (T&& value);
void pop_back();
void resize (size_type count);
void resize (size_type count, value_type const& value);
I recommend working on the functions in the following order. I've also included how many points each part is worth
Invoking make
should create the autograder. If it says autograder up to date
then you can type rm autograder
and re-run make
There can be a lot of output shown from the autograder. Some of it could be overwhelming at times. I recommend adding a couple of arguments to the autograder to help ease the pain.
./autograder -a
Will run the autograder and stop as soon as the first FAILURE is found
./autograder -t
Will list all of the tags for each of the tests. If you want to run a specific subset of tags you can do so by stating the following:
./autograder [access],[iterator]
Will run all tests that have the access and iterator tags
Use good programming style:
Please submit Vector.hpp
to autolab
This lab is graded out of 100 points
Vector