Website Summary Files Commits Branches @commit @diff @stats
path: root / src / List
diff options
context:
space:
mode:
2 files changed, 6 insertions, 0 deletions
-rw-r--r--src/List/List.cpp5
-rw-r--r--src/List/List.h1
diff --git a/src/List/List.cpp b/src/List/List.cpp
index 1ad0679..b77729e 100644
--- a/src/List/List.cpp
+++ b/src/List/List.cpp
@@ -51,6 +51,11 @@ T& List<T>::operator[](unsigned index) {
}
template <class T>
+const T& List<T>::operator[](unsigned index) const {
+ return elements[index];
+}
+
+template <class T>
unsigned List<T>::get_length() const {
return length;
}
diff --git a/src/List/List.h b/src/List/List.h
index f5d56f3..2b5fc00 100644
--- a/src/List/List.h
+++ b/src/List/List.h
@@ -15,6 +15,7 @@ public:
void add(const T& element);
bool removeAt(unsigned index);
T& operator[](unsigned index);
+ const T& operator[](unsigned index) const;
unsigned get_length() const;
unsigned get_count() const;