-
Notifications
You must be signed in to change notification settings - Fork 577
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Type#GetLoadDependencies(): VERIFY() that no nullptr is returned #10155
Conversation
Al2Klimov
commented
Sep 16, 2024
•
edited
Loading
edited
- CC ConfigItem::CommitNewItems(): pre-sort types by their load dependencies once #10003 (comment)
66bb803
to
6a11cf1
Compare
If a specific type shall return no deps, the base method already does that.
3a77ff8
to
d298508
Compare
d298508
to
c24713a
Compare
for (auto& dep : klass.LoadDependencies) | ||
m_Impl << "\t\tauto type" << dep << " (GetByName(\"" << dep << "\").get());" << std::endl; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's much better, but why are you using two different loops for declaring and verifying them? Can't you just combine them like that?
for (auto& dep : klass.LoadDependencies) | |
m_Impl << "\t\tauto type" << dep << " (GetByName(\"" << dep << "\").get());" << std::endl; | |
for (auto& dep : klass.LoadDependencies) { | |
m_Impl << "\t\tauto type" << dep << " (GetByName(\"" << dep << "\").get());" << std::endl; | |
m_Impl << "\t\tVERIFY(type" << dep << ");" << std::endl; | |
} | |
m_Impl << std::endl << "\t\treturn std::unordered_set<Type*>{"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But I prefer this:
const std::unordered_set<Type*>& TypeImpl<Service>::GetLoadDependencies() const
{
static const auto deps ([] {
auto typeApiListener (GetByName("ApiListener").get());
auto typeEndpoint (GetByName("Endpoint").get());
auto typeHost (GetByName("Host").get());
auto typeZone (GetByName("Zone").get());
VERIFY(typeApiListener);
VERIFY(typeEndpoint);
VERIFY(typeHost);
VERIFY(typeZone);
return std::unordered_set{ typeApiListener, typeEndpoint, typeHost, typeZone, };
}());
return deps;
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, let's do this!