diff options
| author | Amlal El Mahrouss <amlal.elmahrouss@icloud.com> | 2024-05-05 21:10:18 +0200 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal.elmahrouss@icloud.com> | 2024-05-05 21:10:18 +0200 |
| commit | f95d8bf159d10b5a9521dcaa0bc37aa0e9dfc02b (patch) | |
| tree | bf8186f1a0521a64983bb0bca4f7b54883542195 /Private/NewKit/Array.hpp | |
| parent | 5a903c1d8f80ca8d7bc5fbea0aea710ce0133f9d (diff) | |
MHR-23: Add run_format.sh, kernel patches.
Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
Diffstat (limited to 'Private/NewKit/Array.hpp')
| -rw-r--r-- | Private/NewKit/Array.hpp | 91 |
1 files changed, 45 insertions, 46 deletions
diff --git a/Private/NewKit/Array.hpp b/Private/NewKit/Array.hpp index 68ca9bfc..1799e025 100644 --- a/Private/NewKit/Array.hpp +++ b/Private/NewKit/Array.hpp @@ -11,60 +11,59 @@ namespace NewOS { -template <typename T, Size N> -class Array final -{ -public: - explicit Array() = default; - ~Array() = default; - - Array &operator=(const Array &) = default; - Array(const Array &) = default; + template <typename T, Size N> + class Array final + { + public: + explicit Array() = default; + ~Array() = default; - ErrorOr<T> operator[](Size At) - { - if (At > N) - return {}; + Array& operator=(const Array&) = default; + Array(const Array&) = default; - kcout << "Returning element\r"; - return ErrorOr<T>(fArray[At]); - } + ErrorOr<T> operator[](Size At) + { + if (At > N) + return {}; - Boolean Empty() const - { - for (auto Val : fArray) - { - if (Val) - return false; - } + kcout << "Returning element\r"; + return ErrorOr<T>(fArray[At]); + } - return true; - } + Boolean Empty() const + { + for (auto Val : fArray) + { + if (Val) + return false; + } - SizeT Count() const - { - SizeT cntElems = 0UL; - for (auto Val : fArray) - { - if (Val) - ++cntElems; - } + return true; + } - return cntElems; - } + SizeT Count() const + { + SizeT cntElems = 0UL; + for (auto Val : fArray) + { + if (Val) + ++cntElems; + } - const T *CData() - { - return fArray; - } + return cntElems; + } - operator bool() - { - return !Empty(); - } + const T* CData() + { + return fArray; + } -private: - T fArray[N]; + operator bool() + { + return !Empty(); + } -}; + private: + T fArray[N]; + }; } // namespace NewOS |
