Skip to content

Commit

Permalink
Using type inference in a few places for iterators.
Browse files Browse the repository at this point in the history
  • Loading branch information
clemahieu committed Oct 20, 2024
1 parent 96501bc commit d4455e4
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions nano/nano_node/entry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1942,7 +1942,7 @@ int main (int argc, char * const * argv)
nano::locked<std::vector<boost::unordered_set<nano::account>>> opened_account_versions_shared (epoch_count);
using opened_account_versions_t = decltype (opened_account_versions_shared)::value_type;
node->store.account.for_each_par (
[&opened_account_versions_shared, epoch_count] (nano::store::read_transaction const & /*unused*/, nano::store::iterator<nano::account, nano::account_info> i, nano::store::iterator<nano::account, nano::account_info> n) {
[&opened_account_versions_shared, epoch_count] (nano::store::read_transaction const & /*unused*/, auto i, auto n) {
// First cache locally
opened_account_versions_t opened_account_versions_l (epoch_count);
for (; i != n; ++i)
Expand Down Expand Up @@ -1979,7 +1979,7 @@ int main (int argc, char * const * argv)
nano::locked<boost::unordered_map<nano::account, std::underlying_type_t<nano::epoch>>> unopened_highest_pending_shared;
using unopened_highest_pending_t = decltype (unopened_highest_pending_shared)::value_type;
node->store.pending.for_each_par (
[&unopened_highest_pending_shared, &opened_accounts] (nano::store::read_transaction const & /*unused*/, nano::store::iterator<nano::pending_key, nano::pending_info> i, nano::store::iterator<nano::pending_key, nano::pending_info> n) {
[&unopened_highest_pending_shared, &opened_accounts] (nano::store::read_transaction const & /*unused*/, auto i, auto n) {
// First cache locally
unopened_highest_pending_t unopened_highest_pending_l;
for (; i != n; ++i)
Expand Down
6 changes: 3 additions & 3 deletions nano/secure/ledger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -749,7 +749,7 @@ void nano::ledger::initialize (nano::generate_cache_flags const & generate_cache
if (generate_cache_flags_a.reps || generate_cache_flags_a.account_count || generate_cache_flags_a.block_count)
{
store.account.for_each_par (
[this] (store::read_transaction const & /*unused*/, store::iterator<nano::account, nano::account_info> i, store::iterator<nano::account, nano::account_info> n) {
[this] (store::read_transaction const & /*unused*/, auto i, auto n) {
uint64_t block_count_l{ 0 };
uint64_t account_count_l{ 0 };
for (; i != n; ++i)
Expand All @@ -763,7 +763,7 @@ void nano::ledger::initialize (nano::generate_cache_flags const & generate_cache
});

store.rep_weight.for_each_par (
[this] (store::read_transaction const & /*unused*/, store::iterator<nano::account, nano::uint128_union> i, store::iterator<nano::account, nano::uint128_union> n) {
[this] (store::read_transaction const & /*unused*/, auto i, auto n) {
nano::rep_weights rep_weights_l{ this->store.rep_weight };
for (; i != n; ++i)
{
Expand All @@ -776,7 +776,7 @@ void nano::ledger::initialize (nano::generate_cache_flags const & generate_cache
if (generate_cache_flags_a.cemented_count)
{
store.confirmation_height.for_each_par (
[this] (store::read_transaction const & /*unused*/, store::iterator<nano::account, nano::confirmation_height_info> i, store::iterator<nano::account, nano::confirmation_height_info> n) {
[this] (store::read_transaction const & /*unused*/, auto i, auto n) {
uint64_t cemented_count_l (0);
for (; i != n; ++i)
{
Expand Down
2 changes: 1 addition & 1 deletion nano/test_common/system.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,7 @@ void nano::test::system::generate_send_existing (nano::node & node_a, std::vecto
nano::account account;
random_pool::generate_block (account.bytes.data (), sizeof (account.bytes));
auto transaction = node_a.ledger.tx_begin_read ();
store::iterator<nano::account, nano::account_info> entry (node_a.store.account.begin (transaction, account));
auto entry = node_a.store.account.begin (transaction, account);
if (entry == node_a.store.account.end ())
{
entry = node_a.store.account.begin (transaction);
Expand Down

0 comments on commit d4455e4

Please sign in to comment.