#pragma once #include "DI/interfaces/copyable_functor.hpp" #include "DI/alloc_functor.hpp" #include /** * A copyable function object. */ template class CopyableFunctor; template class CopyableFunctor : public ICopyableFunctor { public: explicit CopyableFunctor(Function &&function); explicit CopyableFunctor(const Function &function, const Allocator &allocator); explicit CopyableFunctor(const Function &function, Allocator &&allocator); explicit CopyableFunctor(Function &&function, Allocator &&allocator); auto operator()(Args &&...args) -> Return override; auto clone() const -> ICopyableFunctor * override; void clone(ICopyableFunctor *functor) const override; void destroy() noexcept override; void destroy_deallocate() noexcept override; [[nodiscard]] auto target(const std::type_info &type_info) const noexcept -> const void * override; [[nodiscard]] auto target_type() const noexcept -> const std::type_info & override; private: AllocFunctor _functor; }; #include "copyable_functor.tpp"