From e3b0df6ae2a5cd1f98400f671c374b5955bd0bcc Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Sun, 11 Jan 2026 17:48:17 +0100 Subject: chore: kernel: specs fixes and kernel API impl improvements. Signed-off-by: Amlal El Mahrouss --- src/kernel/NeKit/Function.h | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'src/kernel/NeKit/Function.h') diff --git a/src/kernel/NeKit/Function.h b/src/kernel/NeKit/Function.h index d32c0f46..77d9aa23 100644 --- a/src/kernel/NeKit/Function.h +++ b/src/kernel/NeKit/Function.h @@ -1,4 +1,4 @@ -// Copyright 2024-2025, Amlal El Mahrouss (amlal@nekernel.org) +// Copyright 2024-2026, Amlal El Mahrouss (amlal@nekernel.org) // Licensed under the Apache License, Version 2.0 (see LICENSE file) // Official repository: https://github.com/nekernel-org/nekernel @@ -9,22 +9,21 @@ #include namespace Kernel { -/// ================================================================================ -/// @brief Function wrapper class. -/// ================================================================================ + +/// @brief Function Pointer Container. template class Function final { public: Function() = delete; Function(nullPtr) = delete; - ~Function() = default; - explicit Function(T (*Fn)(Args... args)) : fFn(Fn) { MUST_PASS(fFn); } + ~Function() = default; + Function(T (*Fn)(Args... args)) : fFn(Fn) { MUST_PASS(fFn); } Function& operator=(const Function&) = delete; Function(const Function&) = delete; - T operator()(Args&&... args) { return fFn(args...); } + T operator()(Args&&... args) { return fFn(forward(args)...); } explicit operator bool() { return fFn; } bool operator!() { return !fFn; } @@ -35,6 +34,10 @@ class Function final { template using FunctionOr = ErrorOr>; + +template +using FunctionRef = Ref>; + } // namespace Kernel #endif -- cgit v1.2.3