Question: Finish // TODO: Your code here Only. C++ #include #include #include // template class MyVector { public: /******************* * Static constants ******************/ /// Default capacity
Finish // TODO: Your code here Only. C++
#include
// template
} /// Copy constructor MyVector(const MyVector& other) { // TODO: Your code here
} /** * Destructor * Should call clear() so each element gets its destructor called. * Then, de-allocate the internal array and make it a nullptr, if its not already a nullptr. */ ~MyVector() {
// TODO: Your code here } /************ * Operators ************/ /// Assignment operator MyVector& operator=(const MyVector& rhs) { // TODO: Your code here } /// Operator overload to at() T& operator[](size_t index) const { // TODO: Your code here } /************ * Accessors ************/ /// Return the number of valid elements in our data size_t size() const { // TODO: Your code here } /// Return the capacity of our internal array size_t capacity() const { // TODO: Your code here }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
