refactoring: Use direct list initialization for Arg struct #16469

pull hebasto wants to merge 1 commits into bitcoin:master from hebasto:20190726-remove-arg-ctor changing 2 files +1 −3
  1. hebasto commented at 7:56 pm on July 26, 2019: member

    Using a direct list initialization for struct Arg objects makes the constructor needless.

    This PR has been split out from #16097 (see: #16097 (comment)).

  2. refactoring: Use direct list initialization b89eb79b3a
  3. hebasto commented at 8:02 pm on July 26, 2019: member
  4. in src/util/system.cpp:550 in b89eb79b3a
    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});
    


    promag commented at 8:04 pm on July 26, 2019:
    Can’t test at the moment but I think you could drop Arg?

    hebasto commented at 8:16 pm on July 26, 2019:

    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 = ...


    MarcoFalke commented at 8:30 pm on July 26, 2019:
    I’d prefer to keep it. Three ascii chars are not a bloat
  5. promag commented at 8:04 pm on July 26, 2019: member
    ACK.
  6. in src/util/system.h:149 in b89eb79b3a
    146@@ -147,8 +147,6 @@ class ArgsManager
    147         std::string m_help_param;
    148         std::string m_help_text;
    149         bool m_debug_only;
    


    MarcoFalke commented at 8:29 pm on July 26, 2019:
    Can those be const to enforce setting them in the constructor?
  7. DrahtBot added the label Refactoring on Jul 26, 2019
  8. DrahtBot added the label Utils/log/libs on Jul 26, 2019
  9. hebasto closed this on Jul 27, 2019

  10. hebasto deleted the branch on Aug 2, 2019
  11. DrahtBot locked this on Dec 16, 2021

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-11-22 03:12 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me