diff options
| Commit | bc3b45e6e7cfba9251f80e498c87aadbf9b5e7b8 (patch) | |
|---|---|---|
| Author | 2022-06-14 08:13:42 +0300 | |
| Committer | 2022-06-14 08:13:42 +0300 | |
| Files | 39e83c59bca8d0c5926eb0fcbcc10dcd0c9cdebd /src | |
| FMI-OOP-P2_Tables-bc3b45e6e7cfba9251f80e498c87aadbf9b5e7b8.tar FMI-OOP-P2_Tables-bc3b45e6e7cfba9251f80e498c87aadbf9b5e7b8.tar.gz FMI-OOP-P2_Tables-bc3b45e6e7cfba9251f80e498c87aadbf9b5e7b8.zip | ||
| Parent | e968dfecdfed467e6b0af3bc74e8bbe0a71e2020 (diff) | |
Autocommit at 14.06.2022 @ 08:13
1 files changed, 10 insertions, 0 deletions
| -rw-r--r-- | src/Generic/List/List.hpp | 10 |
diff --git a/src/Generic/List/List.hpp b/src/Generic/List/List.hpp index f26e7d1..e0ae8e3 100644 --- a/src/Generic/List/List.hpp +++ b/src/Generic/List/List.hpp @@ -49,6 +49,8 @@ public: const T& operator[](unsigned index) const; //! Returns raw array of data const T* raw_data() const; + //! Removes all data + void clear(); //! Appends elements from other list List<T>& operator+=(const List<T> other); @@ -209,6 +211,14 @@ const T* List<T>::raw_data() const { } template <typename T> +void List<T>::clear() { + free(); + length = 8; + count = 0; + this->elements = new T[length]; +} + +template <typename T> List<T>& List<T>::operator+=(const List<T> other) { for (unsigned i = 0; i < other.length; i++) add(other[i]); |
