Use structured bindings in some places:

Most of the new uses either:
* Replace some uses of `tie`
* bind to pairs when iterating through maps
This commit is contained in:
seelabs
2019-08-06 09:11:32 -07:00
parent 9c58f23cf8
commit 7912ee6f7b
66 changed files with 428 additions and 466 deletions

View File

@@ -608,16 +608,16 @@ int run (int argc, char** argv)
// happen after the config file is loaded.
if (vm.count ("rpc_ip"))
{
auto res = beast::IP::Endpoint::from_string_checked(
auto [endpoint, valid] = beast::IP::Endpoint::from_string_checked(
vm["rpc_ip"].as<std::string>());
if (! res.second)
if (! valid)
{
std::cerr << "Invalid rpc_ip = " <<
vm["rpc_ip"].as<std::string>() << "\n";
return -1;
}
if (res.first.port() == 0)
if (endpoint.port() == 0)
{
std::cerr << "No port specified in rpc_ip.\n";
if (vm.count ("rpc_port"))
@@ -625,9 +625,9 @@ int run (int argc, char** argv)
std::cerr << "WARNING: using deprecated rpc_port param.\n";
try
{
res.first = res.first.at_port(
endpoint = endpoint.at_port(
vm["rpc_port"].as<std::uint16_t>());
if (res.first.port() == 0)
if (endpoint.port() == 0)
throw std::domain_error("0");
}
catch(std::exception const& e)
@@ -640,7 +640,7 @@ int run (int argc, char** argv)
return -1;
}
config->rpc_ip = std::move(res.first);
config->rpc_ip = std::move(endpoint);
}
if (vm.count ("quorum"))