From 33bac1492620908338b8ded1b9878677ccb12e2f Mon Sep 17 00:00:00 2001 From: Felix Brendel Date: Sun, 8 Nov 2020 19:43:21 +0100 Subject: [PATCH] added extend for array list --- arraylist.hpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/arraylist.hpp b/arraylist.hpp index 1619cea..5a56e33 100644 --- a/arraylist.hpp +++ b/arraylist.hpp @@ -26,6 +26,15 @@ struct Array_List { } } + + void extend(std::initializer_list l) { + reserve(l.size()); + for (type e : l) { + append(e); + } + } + + void dealloc() { free(data); data = nullptr;