From 610f91d87152cbe48d3054fcf437d8239da6ef35 Mon Sep 17 00:00:00 2001 From: Amlal Date: Sat, 21 Dec 2024 21:59:13 +0100 Subject: IMP: :boom: Breaking changes some checks are needed to be done. Signed-off-by: Amlal --- dev/Kernel/NewKit/ArrayList.h | 58 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 dev/Kernel/NewKit/ArrayList.h (limited to 'dev/Kernel/NewKit/ArrayList.h') diff --git a/dev/Kernel/NewKit/ArrayList.h b/dev/Kernel/NewKit/ArrayList.h new file mode 100644 index 00000000..822ecab4 --- /dev/null +++ b/dev/Kernel/NewKit/ArrayList.h @@ -0,0 +1,58 @@ +/* ------------------------------------------- + + Copyright (C) 2024, TQ B.V, all rights reserved. + +------------------------------------------- */ + +#pragma once + +#include + +namespace Kernel +{ + template + class ArrayList final + { + public: + explicit ArrayList(T* list) + : fList(reinterpret_cast(list)) + { + } + + ~ArrayList() = default; + + ArrayList& operator=(const ArrayList&) = default; + ArrayList(const ArrayList&) = default; + + T* Data() + { + return fList; + } + + const T* CData() + { + return fList; + } + + T& operator[](int index) const + { + return fList[index]; + } + + operator bool() + { + return fList; + } + + private: + T* fList; + + friend class InitHelpers; + }; + + template + ArrayList make_list(ValueType val) + { + return ArrayList{val}; + } +} // namespace Kernel -- cgit v1.2.3