// Copyright (C) 2023 Jérôme "Lynix" 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 #include namespace Nz { namespace Detail { template struct Pick { template static auto Get(First&& first, Args&&... args) { if constexpr (std::is_same_v>) return std::forward(first); else { NazaraUnused(first); return Get(std::forward(args)...); } } static auto Get() { return T{}; } }; template template ModuleTuple::ModuleTuple(ModuleConfig&&... configs) : ModuleTuple(std::forward(configs)...), ModuleTuple(std::forward(configs)...) { } template template T& ModuleTuple::Get() { if constexpr (std::is_same_v) return ModuleTuple::template Get(); else return ModuleTuple::template Get(); } template template ModuleTuple::ModuleTuple(ModuleConfig&&... configs) : m(Pick::Get(std::forward(configs)...)) { } template template T& ModuleTuple::Get() { static_assert(std::is_same_v, "module is not in the list"); return m; } } template template Modules::Modules(ModuleConfig&&... configs) : m_modules(std::forward(configs)...) { } template template T& Modules::Get() { return m_modules.template Get(); } } #include