// 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 #ifndef NEKIT_FUNCTION_H #define NEKIT_FUNCTION_H #include #include namespace Kernel { /// @brief Function Pointer Container. template class Function final { public: Function() = delete; Function(nullPtr) = delete; ~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(forward(args)...); } explicit operator bool() { return fFn; } bool operator!() { return !fFn; } private: T (*fFn)(Args... args){nullptr}; }; template using FunctionOr = ErrorOr>; template using FunctionRef = Ref>; } // namespace Kernel #endif