// 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 #include namespace Nz { namespace Detail { template struct ModuleHasRegister : std::false_type {}; template struct ModuleHasRegister().RegisterComponent(std::declval()))>> : std::true_type {}; template struct ModuleRegisterer; template struct ModuleRegisterer> { template static void Register(T& modules, C& component) { if constexpr (ModuleHasRegister::value) modules.template Get().RegisterComponent(component); if constexpr (sizeof...(Rest) > 0) ModuleRegisterer>::Register(modules, component); } }; } template template Application::Application(ModuleConfig&&... configs) : m_modules(std::forward(configs)...) { } template template Application::Application(int argc, char** argv, ModuleConfig&&... configs) : ApplicationBase(argc, argv), m_modules(GetCommandLineParameters(), std::forward(configs)...) { } template template Application::Application(int argc, const Pointer* argv, ModuleConfig&&... configs) : ApplicationBase(argc, argv), m_modules(GetCommandLineParameters(), std::forward(configs)...) { } template template T& Application::AddComponent(Args&&... args) { T& component = ApplicationBase::AddComponent(std::forward(args)...); Detail::ModuleRegisterer::template Register(m_modules, component); return component; } template Application::~Application() { // Clear components before releasing modules ClearComponents(); } } #include