903 | @@ -904,9 +904,9 @@ bool AppInitParameterInteraction()
904 | InitWarning(strprintf(_("Reducing -maxconnections from %d to %d, because of system limitations."), nUserMaxConnections, nMaxConnections));
905 |
906 | // ********************************************************* Step 3: parameter-to-internal-flags
907 | - if (mapMultiArgs.count("-debug") > 0) {
908 | + if (argsGlobal.IsArgSet("-debug")) {
909 | // Special-case: if -debug=0/-nodebug is set, turn off debugging messages
910 | - const std::vector<std::string>& categories = mapMultiArgs.at("-debug");
911 | + const std::vector<std::string>& categories = argsGlobal.ArgsAt("-debug");
Can you reference a temporary like this?
You can. The lifetime of the temporary is extended by taking a reference to it. This code is effectively equivalent to:
const std::vector<std::string> categories_tmp = argsGlobal.ArgsAt("-debug");
const std::vector<std::string>& categories = categories_tmp;
At the same time, I didn't do it on purpose here. I'm happy to remove the "&" if that's preferred.