summaryrefslogtreecommitdiffhomepage
path: root/Private/NewKit/Function.hpp
diff options
context:
space:
mode:
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__