From 31c799a02a267d9bface5fd9f5e707597205ce36 Mon Sep 17 00:00:00 2001 From: Pavel Krajcevski Date: Fri, 21 Mar 2014 01:15:35 -0400 Subject: [PATCH] Add equality operators --- Base/include/VectorBase.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Base/include/VectorBase.h b/Base/include/VectorBase.h index 945e176..73023b5 100644 --- a/Base/include/VectorBase.h +++ b/Base/include/VectorBase.h @@ -74,6 +74,20 @@ namespace FasTC { return *this; } + // Equality comparison + template + bool operator==(const VectorBase<_T, N> &v) const { + bool result = true; + for(int i = 0; i < N; i++) + result = result && (vec[i] == v[i]); + return result; + } + + template + bool operator!=(const VectorBase<_T, N> &v) const { + return !(operator==(v)); + } + // Allows casting to other vector types if the underlying type system does as well... template operator VectorBase<_T, N>() const {