// Copyright (C) 2017 Jérôme Leclercq // 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_FUNCTOR_HPP #define NAZARA_FUNCTOR_HPP #include // Inspired from the of code of the SFML by Laurent Gomila namespace Nz { struct Functor { virtual ~Functor() {} virtual void Run() = 0; }; template struct FunctorWithoutArgs : Functor { FunctorWithoutArgs(F func); void Run() override; private: F m_func; }; template struct FunctorWithArgs : Functor { FunctorWithArgs(F func, Args&&... args); void Run() override; private: F m_func; std::tuple m_args; }; template struct MemberWithoutArgs : Functor { MemberWithoutArgs(void (C::*func)(), C* object); void Run() override; private: void (C::*m_func)(); C* m_object; }; } #include #endif // NAZARA_FUNCTOR_HPP