[ox/std] Add operator== to Vector
This commit is contained in:
parent
2dde9473d5
commit
caca376028
12
deps/ox/src/ox/std/vector.hpp
vendored
12
deps/ox/src/ox/std/vector.hpp
vendored
@ -34,6 +34,8 @@ class Vector {
|
||||
|
||||
~Vector();
|
||||
|
||||
bool operator==(const Vector &other) const;
|
||||
|
||||
Vector &operator=(const Vector &other);
|
||||
|
||||
Vector &operator=(Vector &&other);
|
||||
@ -132,6 +134,16 @@ Vector<T>::~Vector() {
|
||||
m_items = nullptr;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
bool Vector<T>::operator==(const Vector<T> &other) const {
|
||||
for (std::size_t i = 0; i < m_size; i++) {
|
||||
if (!(m_items[i] == other.m_items[i])) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
Vector<T> &Vector<T>::operator=(const Vector<T> &other) {
|
||||
this->~Vector<T>();
|
||||
|
Loading…
Reference in New Issue
Block a user