From caca3760289ed6d4286e8b160a41013d21b4137e Mon Sep 17 00:00:00 2001 From: Gary Talent Date: Thu, 15 Apr 2021 23:34:56 -0500 Subject: [PATCH] [ox/std] Add operator== to Vector --- deps/ox/src/ox/std/vector.hpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/deps/ox/src/ox/std/vector.hpp b/deps/ox/src/ox/std/vector.hpp index c5ed2fa8..2c7f3ce8 100644 --- a/deps/ox/src/ox/std/vector.hpp +++ b/deps/ox/src/ox/std/vector.hpp @@ -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::~Vector() { m_items = nullptr; } +template +bool Vector::operator==(const Vector &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 Vector &Vector::operator=(const Vector &other) { this->~Vector();