diff --git a/include/cserver/engine/components.hpp b/include/cserver/engine/components.hpp index 9c277eb..9f2d801 100644 --- a/include/cserver/engine/components.hpp +++ b/include/cserver/engine/components.hpp @@ -261,21 +261,32 @@ struct ServiceContext { constexpr auto GetContextFor() /* Internal Use Only */ { return impl::ServiceContextForComponent>{*this}; }; - - +private: + static constexpr struct { + constexpr auto operator=(auto&&) const noexcept {}; + } ComponentType{}; + static constexpr struct { + constexpr auto operator=(auto&&) const noexcept {}; + } ComponentName{}; + static constexpr struct { + constexpr auto operator=(auto&&) const noexcept {}; + } ComponentOptions{}; + static constexpr struct { + constexpr auto operator=(auto&&) const noexcept {}; + } RequiredComponent; +public: template constexpr auto FindComponent() -> decltype(*Get(this->storage))& { constexpr auto Index = kUtils.GetIndexByName(Current::kName); - - constexpr utempl::ConstexprString name = Current::kName; - constexpr Options options = Current::kOptions; + constexpr auto J = utempl::loopholes::Counter>(); constexpr auto dependencies = Get(DependencyGraph); static_assert(( - /* Component Type */ std::ignore = utempl::kType, - /* Component Name */ std::ignore = name, - /* Component Options */ std::ignore = options, - dependencies.size() != 0), "Constructor is not declared as constexpr"); + ComponentType = utempl::kType, + ComponentName = utempl::kWrapper, + ComponentOptions = utempl::kWrapper, + RequiredComponent = utempl::kType(kUtils.kComponentConfigs))>, + dependencies.size() > J), "Constructor is not declared as constexpr"); return *Get(this->storage); };