diff options
Autocommit at 07.05.2022 @ 11:07
2 files changed, 8 insertions, 8 deletions
| -rw-r--r-- | src/Generic/List/List.hpp | 8 | ||||
| -rw-r--r-- | src/Generic/List/OrderedList.hpp | 8 |
diff --git a/src/Generic/List/List.hpp b/src/Generic/List/List.hpp index 7088f2e..c798590 100644 --- a/src/Generic/List/List.hpp +++ b/src/Generic/List/List.hpp @@ -17,8 +17,8 @@ protected: public: List(const T* elements, unsigned elementsCount); - void add(const T& element); - void insertAt(const T& element, unsigned index); + void add(T element); + void insertAt(T element, unsigned index); bool removeAt(unsigned index); unsigned findIndex(const T& element) const; bool contain(const T& element) const; @@ -78,14 +78,14 @@ List<T>::List(const T* elements, unsigned elementsCount) { } template <class T> -void List<T>::add(const T& element) { +void List<T>::add(T element) { if (length == count) resize(); elements[count++] = element; } template <class T> -void List<T>::insertAt(const T& element, unsigned index) { +void List<T>::insertAt(T element, unsigned index) { if (index >= count) add(element); if (length == count) resize(); diff --git a/src/Generic/List/OrderedList.hpp b/src/Generic/List/OrderedList.hpp index 4396d33..83fb68a 100644 --- a/src/Generic/List/OrderedList.hpp +++ b/src/Generic/List/OrderedList.hpp @@ -9,10 +9,10 @@ public: OrderedList(); OrderedList(const T* elements, unsigned elementsCount); - void add(const T& element) = delete; - void insertAt(const T& element, unsigned index) = delete; + void add(T element) = delete; + void insertAt(T element, unsigned index) = delete; - void insert(const T& element); + void insert(T element); // unsigned findIndex(const T& element) const; TODO: binary search }; @@ -23,7 +23,7 @@ template <class T> OrderedList<T>::OrderedList(const T* elements, unsigned elementsCount) : List<T>::List(elements, elementsCount) {} template <class T> -void OrderedList<T>::insert(const T& element) { +void OrderedList<T>::insert(T element) { if (List<T>::length == List<T>::count) List<T>::resize(); unsigned insertionInd = 0; |
