// Copyright (C) 2024 Jérôme "SirLynix" Leclercq (lynix680@gmail.com) // This file is part of the "Nazara Engine - Core module" // For conditions of distribution and use, see copyright notice in Config.hpp #pragma once #ifndef NAZARA_CORE_FUNCTOR_HPP #define NAZARA_CORE_FUNCTOR_HPP #include // Inspired from the of code of the SFML by Laurent Gomila namespace Nz { struct AbstractFunctor { virtual ~AbstractFunctor() {} virtual void Run() = 0; }; template struct FunctorWithoutArgs : AbstractFunctor { FunctorWithoutArgs(F func); void Run() override; private: F m_func; }; template struct FunctorWithArgs : AbstractFunctor { FunctorWithArgs(F func, Args&&... args); void Run() override; private: F m_func; std::tuple m_args; }; template struct MemberWithoutArgs : AbstractFunctor { MemberWithoutArgs(void (C::*func)(), C* object); void Run() override; private: void (C::*m_func)(); C* m_object; }; } #include #endif // NAZARA_CORE_FUNCTOR_HPP