Website Summary Files Commits Branches @commit @diff @stats
path: root / src / List
diff options
context:
space:
mode:
2 files changed, 6 insertions, 1 deletions
-rw-r--r--src/List/List.cpp5
-rw-r--r--src/List/List.h2
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
@@ -72,6 +72,11 @@ unsigned List<T>::findIndex(const T& element) const {
}
template <class T>
+bool List<T>::contain(const T& element) const {
+ return findIndex(element) < count;
+}
+
+template <class T>
T& List<T>::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;