diff options
Autocommit at 07.05.2022 @ 11:37
1 files changed, 4 insertions, 1 deletions
| -rw-r--r-- | src/Generic/List/List.hpp | 5 |
diff --git a/src/Generic/List/List.hpp b/src/Generic/List/List.hpp index c798590..d2a759f 100644 --- a/src/Generic/List/List.hpp +++ b/src/Generic/List/List.hpp @@ -86,7 +86,10 @@ void List<T>::add(T element) { template <class T> void List<T>::insertAt(T element, unsigned index) { - if (index >= count) add(element); + if (index >= count) { + add(element); + return; + } if (length == count) resize(); for (unsigned i = count; i > index; i--) |
