summaryrefslogtreecommitdiffhomepage
path: root/Private/NewKit/Function.hpp
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal@el-mahrouss-logic.com>2024-03-27 17:38:23 +0100
committerAmlal El Mahrouss <amlal@el-mahrouss-logic.com>2024-03-27 17:38:23 +0100
commit1ce16b83dba0326b13dfa3399c1497ac6b1af14d (patch)
tree8a5e4063b5d4cf6ce4f42dd500073994e9ef8954 /Private/NewKit/Function.hpp
parent6a18e607ffc4e83f2bd953c9de5c14f18e077df8 (diff)
Kernel && Developer:
Developer: - Rework System API to use C instead of C++ - Add new calls in Thread.h - Documented code. Kernel: - Rework handover stage, separated the Processor specific code from the cross platform code. Signed-off-by: Amlal El Mahrouss <amlal@el-mahrouss-logic.com>
Diffstat (limited to 'Private/NewKit/Function.hpp')
-rw-r--r--Private/NewKit/Function.hpp79
1 files changed, 34 insertions, 45 deletions
diff --git a/Private/NewKit/Function.hpp b/Private/NewKit/Function.hpp
index 04a93bee..20d63f80 100644
--- a/Private/NewKit/Function.hpp
+++ b/Private/NewKit/Function.hpp
@@ -3,48 +3,37 @@
#include <NewKit/Defines.hpp>
-namespace HCore
-{
- template <typename T, typename... Args>
- class Function final
- {
- public:
- Function() = default;
-
- public:
- explicit Function(T (*Fn)(Args... args))
- : m_Fn(Fn)
- {}
-
- ~Function() = default;
-
- Function &operator=(const Function &) = default;
- Function(const Function &) = default;
-
- template <typename... XArgs> T operator()(Args... args)
- {
- return m_Fn(args...);
- }
-
- template <typename... XArgs> T Call(Args... args)
- {
- return m_Fn(args...);
- }
-
- operator bool()
- {
- return m_Fn;
- }
-
- bool operator!()
- {
- return !m_Fn;
- }
-
- private:
- T (*m_Fn)(Args... args);
-
- };
-} // namespace HCore
-
-#endif // !_INC_FUNCTION_HPP__
+namespace HCore {
+template <typename T, typename... Args>
+class Function final {
+ public:
+ Function() = default;
+
+ public:
+ explicit Function(T (*Fn)(Args... args)) : m_Fn(Fn) {}
+
+ ~Function() = default;
+
+ Function &operator=(const Function &) = default;
+ Function(const Function &) = default;
+
+ template <typename... XArgs>
+ T operator()(Args... args) {
+ return m_Fn(args...);
+ }
+
+ template <typename... XArgs>
+ T Call(Args... args) {
+ return m_Fn(args...);
+ }
+
+ operator bool() { return m_Fn; }
+
+ bool operator!() { return !m_Fn; }
+
+ private:
+ T (*m_Fn)(Args... args);
+};
+} // namespace HCore
+
+#endif // !_INC_FUNCTION_HPP__