Add vector copy and assignment operators. FIXME
This commit is contained in:
parent
5231758bbe
commit
7513280c73
@ -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
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user