diff options
| author | Amlal El Mahrouss <amlal@nekernel.org> | 2025-12-09 05:12:57 +0100 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal@nekernel.org> | 2025-12-09 05:48:25 +0100 |
| commit | 64c23b15059649aeee6d08c7940d0ff1b56512b5 (patch) | |
| tree | c6e826d0b7f92d681563b8b381e36bf86628f8f1 /src/kernel/NeKit/InitializerList.h | |
| parent | 4d192e629a07ae457134cb0063e0136e54b01008 (diff) | |
feat: New `InitializerList` class, and `LHGetLaunchInfo` implementation on `LaunchHelpers.fwrk`.v0.0.82
fix: Fix operator!= in the `Atom` class.
Signed-off-by: Amlal El Mahrouss <amlal@nekernel.org>
Diffstat (limited to 'src/kernel/NeKit/InitializerList.h')
| -rw-r--r-- | src/kernel/NeKit/InitializerList.h | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/src/kernel/NeKit/InitializerList.h b/src/kernel/NeKit/InitializerList.h new file mode 100644 index 00000000..158b88ed --- /dev/null +++ b/src/kernel/NeKit/InitializerList.h @@ -0,0 +1,42 @@ +/* ======================================== + + Copyright (C) 2024-2025, Amlal El Mahrouss, licensed under the Apache 2.0 license. + +======================================== */ + +#pragma once + +#include <NeKit/Config.h> + +namespace Kernel { +template <typename T, SizeT N> +class InitializerList final { + public: + explicit InitializerList(const T* list) { + if constexpr (N > 0) { + for (auto i = 0UL; i < N; ++i) { + fList[i] = list[i]; + } + } + } + + ~InitializerList() = default; + + InitializerList& operator=(const InitializerList&) = default; + InitializerList(const InitializerList&) = default; + + T* begin() { return fList; } + T* operator->() { return fList; } + T* operator*() { return fList; } + T* end() { return fList + N; } + constexpr SizeT size() const { return N; } + + private: + T fList[N]; +}; + +template <typename ValueType, SizeT N> +inline InitializerList<ValueType, N> make_list(ValueType& val) { + return InitializerList<ValueType, N>{val}; +} +} // namespace Kernel |
