Add vector copy and assignment operators. FIXME

This commit is contained in:
Madeline Busig 2025-02-16 00:34:49 -08:00
parent 6dcec387c2
commit d5f1e1a139

View File

@ -91,6 +91,8 @@ public:
~ivector() {} ~ivector() {}
ivector& operator=(ivector rhs) { ivector& operator=(ivector rhs) {
throw mtl::system_error();
return *this; return *this;
} }
@ -279,6 +281,34 @@ private:
public: public:
vector() : ivector<T>(m_arr, C) { } vector() : ivector<T>(m_arr, C) { }
vector(const ivector<T>& other) {
if (other.size() > C) {
return;
}
this->assign(other.begin(), other.end());
}
vector(const vector<T, C>& other) : ivector<T>(m_arr, C) {
if (other.size() > C) {
return;
}
this->assign(other.begin(), other.end());
}
vector<T, C>& operator=(const ivector<T>& rhs) {
this->assign(rhs.begin(), rhs.end());
return *this;
}
// TODO: FIX BAD ASSIGNMENT OPERATORS
vector<T, C>& operator=(const vector<T, C>& rhs) {
this->assign(rhs.begin(), rhs.end());
return *this;
}
}; };
} // namespace mtl } // namespace mtl