From 0521180c61e7d8970f164f3154599e49800e85c6 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Mon, 2 May 2022 21:40:36 +0300 Subject: Autocommit at 02.05.2022 @ 21:40 --- src/List/List.cpp | 5 +++++ src/List/List.h | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'src/List') diff --git a/src/List/List.cpp b/src/List/List.cpp index d5c2f04..d455c04 100644 --- a/src/List/List.cpp +++ b/src/List/List.cpp @@ -71,6 +71,11 @@ unsigned List::findIndex(const T& element) const { return ind; } +template +bool List::contain(const T& element) const { + return findIndex(element) < count; +} + template T& List::operator[](unsigned index) { return elements[index]; diff --git a/src/List/List.h b/src/List/List.h index 24003a6..23e3ee5 100644 --- a/src/List/List.h +++ b/src/List/List.h @@ -20,7 +20,7 @@ public: bool insertAt(const T& element, unsigned index); bool removeAt(unsigned index); unsigned findIndex(const T& element) const; - bool contains(const T& element) const; + bool contain(const T& element) const; T& operator[](unsigned index); const T& operator[](unsigned index) const; -- cgit v1.3.1-26-gb76a