From 6fa87ec35f9ee8cd65cfdcb16c31af6dff7911d2 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Mon, 2 May 2022 20:55:21 +0300 Subject: Autocommit at 02.05.2022 @ 20:55 --- src/List/List.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/List/List.cpp') diff --git a/src/List/List.cpp b/src/List/List.cpp index f65cbba..617bbcf 100644 --- a/src/List/List.cpp +++ b/src/List/List.cpp @@ -42,7 +42,10 @@ void List::add(const T& element) { } template -bool List::insertAt(const T& element) { +bool List::insertAt(const T& element, unsigned index) { + if (index >= count) + return add(element); + } -- cgit v1.3.1-23-gd82d