summaryrefslogtreecommitdiffhomepage
path: root/Private/NewKit/Function.hpp
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2024-05-05 21:10:18 +0200
committerAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2024-05-05 21:10:18 +0200
commitf95d8bf159d10b5a9521dcaa0bc37aa0e9dfc02b (patch)
treebf8186f1a0521a64983bb0bca4f7b54883542195 /Private/NewKit/Function.hpp
parent5a903c1d8f80ca8d7bc5fbea0aea710ce0133f9d (diff)
MHR-23: Add run_format.sh, kernel patches.
Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
Diffstat (limited to 'Private/NewKit/Function.hpp')
-rw-r--r--Private/NewKit/Function.hpp82
1 files changed, 48 insertions, 34 deletions
diff --git a/Private/NewKit/Function.hpp b/Private/NewKit/Function.hpp
index 79d33a3b..12ae03f3 100644
--- a/Private/NewKit/Function.hpp
+++ b/Private/NewKit/Function.hpp
@@ -3,37 +3,51 @@
#include <NewKit/Defines.hpp>
-namespace NewOS {
-template <typename T, typename... Args>
-class Function final {
- public:
- Function() = default;
-
- public:
- explicit Function(T (*Fn)(Args... args)) : fFn(Fn) {}
-
- ~Function() = default;
-
- Function &operator=(const Function &) = default;
- Function(const Function &) = default;
-
- template <typename... XArgs>
- T operator()(Args... args) {
- return fFn(args...);
- }
-
- template <typename... XArgs>
- T Call(Args... args) {
- return fFn(args...);
- }
-
- operator bool() { return fFn; }
-
- bool operator!() { return !fFn; }
-
- private:
- T (*fFn)(Args... args);
-};
-} // namespace NewOS
-
-#endif // !_INC_FUNCTION_HPP__
+namespace NewOS
+{
+ template <typename T, typename... Args>
+ class Function final
+ {
+ public:
+ Function() = default;
+
+ public:
+ explicit Function(T (*Fn)(Args... args))
+ : fFn(Fn)
+ {
+ }
+
+ ~Function() = default;
+
+ Function& operator=(const Function&) = default;
+ Function(const Function&) = default;
+
+ template <typename... XArgs>
+ T operator()(Args... args)
+ {
+ return fFn(args...);
+ }
+
+ template <typename... XArgs>
+ T Call(Args... args)
+ {
+ return fFn(args...);
+ }
+
+ operator bool()
+ {
+ return fFn;
+ }
+
+ bool operator!()
+ {
+ return !fFn;
+ }
+
+ private:
+ T(*fFn)
+ (Args... args);
+ };
+} // namespace NewOS
+
+#endif // !_INC_FUNCTION_HPP__