Using a direct list initialization for struct Arg objects makes the constructor needless.
This PR has been split out from #16097 (see: #16097 (comment)).
Using a direct list initialization for struct Arg objects makes the constructor needless.
This PR has been split out from #16097 (see: #16097 (comment)).
ping @ryanofsky @promag
546 | @@ -547,7 +547,7 @@ void ArgsManager::AddArg(const std::string& name, const std::string& help, const 547 | 548 | LOCK(cs_args); 549 | std::map<std::string, Arg>& arg_map = m_available_args[cat]; 550 | - auto ret = arg_map.emplace(name.substr(0, eq_index), Arg(name.substr(eq_index, name.size() - eq_index), help, debug_only)); 551 | + auto ret = arg_map.emplace(name.substr(0, eq_index), Arg{name.substr(eq_index, name.size() - eq_index), help, debug_only});
Can't test at the moment but I think you could drop Arg?
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 = ...
I'd prefer to keep it. Three ascii chars are not a bloat
ACK.
146 | @@ -147,8 +147,6 @@ class ArgsManager
147 | std::string m_help_param;
148 | std::string m_help_text;
149 | bool m_debug_only;
Can those be const to enforce setting them in the constructor?