refactor: replace sizeof(a)/sizeof(a[0]) by std::size (C++17)

Removes the macro ARRAYLEN and also substitutes all other uses of the same
"sizeof(a)/sizeof(a[0])" pattern by std::size, available since C++17.
This commit is contained in:
Sebastian Falbesoner
2020-11-20 00:14:32 +01:00
parent 365539c846
commit e829c9afbf
9 changed files with 12 additions and 15 deletions

View File

@@ -216,7 +216,7 @@ BOOST_AUTO_TEST_CASE(CreateNewBlock_validity)
// We can't make transactions until we have inputs
// Therefore, load 110 blocks :)
static_assert(sizeof(blockinfo) / sizeof(*blockinfo) == 110, "Should have 110 blocks to import");
static_assert(std::size(blockinfo) == 110, "Should have 110 blocks to import");
int baseheight = 0;
std::vector<CTransactionRef> txFirst;
for (const auto& bi : blockinfo) {