diff options
Diffstat (limited to 'Kernel/NewKit')
| -rw-r--r-- | Kernel/NewKit/Array.hpp | 14 | ||||
| -rw-r--r-- | Kernel/NewKit/MutableArray.hpp | 7 | ||||
| -rw-r--r-- | Kernel/NewKit/String.hpp | 2 |
3 files changed, 11 insertions, 12 deletions
diff --git a/Kernel/NewKit/Array.hpp b/Kernel/NewKit/Array.hpp index b8386c9a..b0b94584 100644 --- a/Kernel/NewKit/Array.hpp +++ b/Kernel/NewKit/Array.hpp @@ -21,13 +21,12 @@ namespace NewOS Array& operator=(const Array&) = default; Array(const Array&) = default; - ErrorOr<T> operator[](Size At) + ErrorOr<T*> operator[](Size At) { if (At > N) return {}; - kcout << "Returning element\r"; - return ErrorOr<T>(fArray[At]); + return ErrorOr<T*>(&fArray[At]); } Boolean Empty() const @@ -43,14 +42,7 @@ namespace NewOS SizeT Count() const { - SizeT cntElems = 0UL; - for (auto Val : fArray) - { - if (Val) - ++cntElems; - } - - return cntElems; + return N; } const T* CData() diff --git a/Kernel/NewKit/MutableArray.hpp b/Kernel/NewKit/MutableArray.hpp index f9c79301..6be9c15e 100644 --- a/Kernel/NewKit/MutableArray.hpp +++ b/Kernel/NewKit/MutableArray.hpp @@ -170,6 +170,13 @@ namespace NewOS Boolean Add(const T val) { auto* iterationNode = fFirstNode; + + if (!iterationNode) + { + fFirstNode = new MutableLinkedList<T>(); + iterationNode = fFirstNode; + } + MUST_PASS(iterationNode); while (iterationNode) diff --git a/Kernel/NewKit/String.hpp b/Kernel/NewKit/String.hpp index 644a1394..14286ca0 100644 --- a/Kernel/NewKit/String.hpp +++ b/Kernel/NewKit/String.hpp @@ -35,7 +35,7 @@ namespace NewOS StringView(const StringView&) = default; Char* Data(); - const Char* CData(); + const Char* CData() const; Size Length() const; bool operator==(const Char* rhs) const; |
