use const refs in for loops for non tiny types

This commit is contained in:
moneromooo-monero 2017-12-13 11:21:18 +00:00
parent f0568ca6ac
commit b51dc56687
No known key found for this signature in database
GPG key ID: 686F07454D6CEFC3
5 changed files with 5 additions and 5 deletions

View file

@ -459,7 +459,7 @@ int import_from_file(cryptonote::core& core, const std::string& import_file_path
// tx number 1: coinbase tx
// tx number 2 onwards: archived_txs
for (transaction tx : archived_txs)
for (const transaction &tx : archived_txs)
{
// add blocks with verification.
// for Blockchain and blockchain_storage add_new_block().

View file

@ -385,7 +385,7 @@ float block_queue::get_speed(const boost::uuids::uuid &connection_id) const
i->second = (i->second + span.rate) / 2;
}
float conn_rate = -1, best_rate = 0;
for (auto i: speeds)
for (const auto &i: speeds)
{
if (i.first == connection_id)
conn_rate = i.second;

View file

@ -1611,7 +1611,7 @@ bool t_rpc_command_executor::alt_chain_info()
}
tools::msg_writer() << boost::lexical_cast<std::string>(res.chains.size()) << " alternate chains found:";
for (const auto chain: res.chains)
for (const auto &chain: res.chains)
{
uint64_t start_height = (chain.height - chain.length + 1);
tools::msg_writer() << chain.length << " blocks long, from height " << start_height << " (" << (ires.height - start_height - 1)

View file

@ -51,7 +51,7 @@ class size_logger
public:
~size_logger()
{
for (const auto i: types)
for (const auto &i: types)
std::cout << std::to_string(i.first) << "\t" << i.second << std::endl;
}
void add(const char *type, size_t size) { types.insert(std::make_pair(size, type)); }

View file

@ -5126,7 +5126,7 @@ void wallet2::get_outs(std::vector<std::vector<tools::wallet2::get_outs_entry>>
// if there are just enough outputs to mix with, use all of them.
// Eventually this should become impossible.
uint64_t num_outs = 0, num_recent_outs = 0;
for (auto he: resp_t.result.histogram)
for (const auto &he: resp_t.result.histogram)
{
if (he.amount == amount)
{