From 26d3ecce1211b58dbe79302844395c550340d946 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Mon, 2 May 2022 21:35:34 +0300 Subject: Autocommit at 02.05.2022 @ 21:35 --- src/List/List.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/List/List.cpp') diff --git a/src/List/List.cpp b/src/List/List.cpp index 7236616..d5c2f04 100644 --- a/src/List/List.cpp +++ b/src/List/List.cpp @@ -63,6 +63,14 @@ bool List::removeAt(unsigned index) { elements[count--] = nullptr; } +template +unsigned List::findIndex(const T& element) const { + unsigned ind = 0; + while (ind < count && elements[ind].compare(element) != 0) + ind++; + return ind; +} + template T& List::operator[](unsigned index) { return elements[index]; -- cgit v1.3.1-26-gb76a