-
Notifications
You must be signed in to change notification settings - Fork 38.7k
refactoring: Use direct list initialization for Arg struct #16469
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
Conversation
|
ping @ryanofsky @promag |
promag
left a comment
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.
ACK.
| LOCK(cs_args); | ||
| std::map<std::string, Arg>& arg_map = m_available_args[cat]; | ||
| auto ret = arg_map.emplace(name.substr(0, eq_index), Arg(name.substr(eq_index, name.size() - eq_index), help, debug_only)); | ||
| auto ret = arg_map.emplace(name.substr(0, eq_index), Arg{name.substr(eq_index, name.size() - eq_index), help, debug_only}); |
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.
Can't test at the moment but I think you could drop Arg?
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.
Can't test at the moment but I think you could drop
Arg?
It won't work if a type is automatically deduced: auto ret = ...
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.
I'd prefer to keep it. Three ascii chars are not a bloat
| { | ||
| std::string m_help_param; | ||
| std::string m_help_text; | ||
| bool m_debug_only; |
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.
Can those be const to enforce setting them in the constructor?
| LOCK(cs_args); | ||
| std::map<std::string, Arg>& arg_map = m_available_args[cat]; | ||
| auto ret = arg_map.emplace(name.substr(0, eq_index), Arg(name.substr(eq_index, name.size() - eq_index), help, debug_only)); | ||
| auto ret = arg_map.emplace(name.substr(0, eq_index), Arg{name.substr(eq_index, name.size() - eq_index), help, debug_only}); |
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.
I'd prefer to keep it. Three ascii chars are not a bloat
Using a direct list initialization for
struct Argobjects makes the constructor needless.This PR has been split out from #16097 (see: #16097 (comment)).