summaryrefslogtreecommitdiffhomepage
path: root/src/kernel/NeKit/Function.h
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal@nekernel.org>2025-12-10 10:05:53 +0100
committerAmlal El Mahrouss <amlal@nekernel.org>2025-12-10 10:08:00 +0100
commit031789eeb226b2b559f0edbaf28ed5bebc6ddff4 (patch)
treef068128f603c75f97ba766290b6c8c2be05afe8f /src/kernel/NeKit/Function.h
parent64c23b15059649aeee6d08c7940d0ff1b56512b5 (diff)
chore: new `InitializerList` API.
Signed-off-by: Amlal El Mahrouss <amlal@nekernel.org>
Diffstat (limited to 'src/kernel/NeKit/Function.h')
-rw-r--r--src/kernel/NeKit/Function.h18
1 files changed, 7 insertions, 11 deletions
diff --git a/src/kernel/NeKit/Function.h b/src/kernel/NeKit/Function.h
index 1ceda345..2889e055 100644
--- a/src/kernel/NeKit/Function.h
+++ b/src/kernel/NeKit/Function.h
@@ -16,28 +16,24 @@ namespace Kernel {
template <typename T, typename... Args>
class Function final {
public:
- Function() = default;
-
- public:
- explicit Function(T (*Fn)(Args... args)) : fFn(Fn) {}
-
+ Function() = delete;
+ Function(nullPtr) = delete;
~Function() = default;
- Function& operator=(const Function&) = default;
- Function(const Function&) = default;
+ explicit Function(T (*Fn)(Args... args)) : fFn(Fn) { MUST_PASS(fFn); }
+
+ Function& operator=(const Function&) = delete;
+ Function(const Function&) = delete;
- template <typename... XArgs>
T operator()(Args&&... args) {
return fFn(args...);
}
- template <typename... XArgs>
T Call(Args&&... args) {
return fFn(args...);
}
- operator bool() { return fFn; }
-
+ explicit operator bool() { return fFn; }
bool operator!() { return !fFn; }
private: