From 97a4d8e0ab98cf523f3329ab750cfd8f2679d80e Mon Sep 17 00:00:00 2001 From: Micke Nordin Date: Mon, 18 Jul 2022 13:25:51 +0200 Subject: [PATCH] Format --- vector.hpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/vector.hpp b/vector.hpp index 5cd099c..a330312 100644 --- a/vector.hpp +++ b/vector.hpp @@ -32,15 +32,16 @@ public: ~vector() { this->dimention = 0; free(this->entries); - this->entries = NULL; + //this->entries = NULL; + this->err = true; } long long get_dimention() const { return this->dimention; } cnumber *get_entries() const { return this->entries; } cnumber get_entry(const long long index) const { if (index < this->get_dimention()) { - return this->entries[index]; + return this->entries[index]; } - return cnumber(0,0); + return cnumber(0, 0); } void set_entry(const long long index, const cnumber z) { if (index < this->get_dimention()) { @@ -52,7 +53,8 @@ public: return this->get_entry(index); } - // FIXME: Figure out how to make sure you do not try to access something outside of the index + // FIXME: Figure out how to make sure you do not try to access something + // outside of the index cnumber &operator[](const long long index) { return this->entries[index]; } friend ostream &operator<<(ostream &os, const vector &v) { @@ -101,7 +103,7 @@ public: return product; } const cnumber operator*(const vector &v) const { - cnumber res(0,0); + cnumber res(0, 0); for (long long i = 0; i < this->get_dimention(); i++) { res = res + this->get_entry(i) * v.get_entry(i); }