diff options
Diffstat (limited to 'dev/kernel/NewKit/Array.h')
| -rw-r--r-- | dev/kernel/NewKit/Array.h | 73 |
1 files changed, 27 insertions, 46 deletions
diff --git a/dev/kernel/NewKit/Array.h b/dev/kernel/NewKit/Array.h index 1dcc6720..af73d002 100644 --- a/dev/kernel/NewKit/Array.h +++ b/dev/kernel/NewKit/Array.h @@ -1,65 +1,46 @@ /* ------------------------------------------- - Copyright (C) 2024-2025, Amlal El Mahrouss, all rights reserved. + Copyright (C) 2024-2025, Amlal El Mahrouss, all rights reserved. ------------------------------------------- */ #pragma once #include <KernelKit/DebugOutput.h> -#include <NewKit/ErrorOr.h> #include <NewKit/Defines.h> +#include <NewKit/ErrorOr.h> -namespace Kernel -{ - template <typename T, SizeT N> - class Array final - { - public: - explicit Array() = default; - ~Array() = default; +namespace Kernel { +template <typename T, SizeT N> +class Array final { + public: + explicit Array() = default; + ~Array() = default; - Array& operator=(const Array&) = default; - Array(const Array&) = default; + Array& operator=(const Array&) = default; + Array(const Array&) = default; - T& operator[](SizeT at) - { - MUST_PASS(at < this->Count()); - return fArray[at]; - } + T& operator[](SizeT at) { + MUST_PASS(at < this->Count()); + return fArray[at]; + } - Boolean Empty() - { - return this->Count() > 0; - } + Boolean Empty() { return this->Count() > 0; } - SizeT Capacity() - { - return N; - } + SizeT Capacity() { return N; } - SizeT Count() - { - return N; - } + SizeT Count() { return N; } - const T* CData() - { - return fArray; - } + const T* CData() { return fArray; } - operator bool() - { - return !Empty(); - } + operator bool() { return !Empty(); } - private: - T fArray[N]; - }; + private: + T fArray[N]; +}; - template <typename ValueType> - auto make_list(ValueType val) - { - return Array<ValueType, ARRAY_SIZE(val)>{val}; - } -} // namespace Kernel +template <typename ValueType> +auto make_list(ValueType val) { + return Array<ValueType, ARRAY_SIZE(val)>{val}; +} +} // namespace Kernel |
