Website Summary Files Commits Branches @commit @diff @stats
path: root / src / Generic
diff options
context:
space:
mode:
Commitbc3b45e6e7cfba9251f80e498c87aadbf9b5e7b8 (patch)
Author
 Syndamia <kamen@syndamia.com>
2022-06-14 08:13:42 +0300
Committer
 Syndamia <kamen@syndamia.com>
2022-06-14 08:13:42 +0300
Files39e83c59bca8d0c5926eb0fcbcc10dcd0c9cdebd /src/Generic
FMI-OOP-P2_Tables-bc3b45e6e7cfba9251f80e498c87aadbf9b5e7b8.tar
FMI-OOP-P2_Tables-bc3b45e6e7cfba9251f80e498c87aadbf9b5e7b8.tar.gz
FMI-OOP-P2_Tables-bc3b45e6e7cfba9251f80e498c87aadbf9b5e7b8.zip
Parente968dfecdfed467e6b0af3bc74e8bbe0a71e2020 (diff)
Autocommit at 14.06.2022 @ 08:13
1 files changed, 10 insertions, 0 deletions
-rw-r--r--src/Generic/List/List.hpp10
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]);