Website Summary Files Commits Branches @commit @diff @stats
path: root / src / List
diff options
context:
space:
mode:
Commit0521180c61e7d8970f164f3154599e49800e85c6 (patch)
Author
 Syndamia <kamen.d.mladenov@protonmail.com>
2022-05-02 21:40:36 +0300
Committer
 Syndamia <kamen.d.mladenov@protonmail.com>
2022-05-02 21:40:36 +0300
Files33d4af5bcc2acc4fdde00401ae522365c19c17de /src/List
FMI-OOP-P1_TicketSystem-0521180c61e7d8970f164f3154599e49800e85c6.tar
FMI-OOP-P1_TicketSystem-0521180c61e7d8970f164f3154599e49800e85c6.tar.gz
FMI-OOP-P1_TicketSystem-0521180c61e7d8970f164f3154599e49800e85c6.zip
Parent26d3ecce1211b58dbe79302844395c550340d946 (diff)
Autocommit at 02.05.2022 @ 21:40
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;