mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-10 22:18:54 +01:00
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:
@@ -164,9 +164,9 @@ static void RunOperators(const int64_t& num1, const int64_t& num2)
|
||||
|
||||
BOOST_AUTO_TEST_CASE(creation)
|
||||
{
|
||||
for(size_t i = 0; i < sizeof(values) / sizeof(values[0]); ++i)
|
||||
for(size_t i = 0; i < std::size(values); ++i)
|
||||
{
|
||||
for(size_t j = 0; j < sizeof(offsets) / sizeof(offsets[0]); ++j)
|
||||
for(size_t j = 0; j < std::size(offsets); ++j)
|
||||
{
|
||||
RunCreate(values[i]);
|
||||
RunCreate(values[i] + offsets[j]);
|
||||
@@ -177,9 +177,9 @@ BOOST_AUTO_TEST_CASE(creation)
|
||||
|
||||
BOOST_AUTO_TEST_CASE(operators)
|
||||
{
|
||||
for(size_t i = 0; i < sizeof(values) / sizeof(values[0]); ++i)
|
||||
for(size_t i = 0; i < std::size(values); ++i)
|
||||
{
|
||||
for(size_t j = 0; j < sizeof(offsets) / sizeof(offsets[0]); ++j)
|
||||
for(size_t j = 0; j < std::size(offsets); ++j)
|
||||
{
|
||||
RunOperators(values[i], values[i]);
|
||||
RunOperators(values[i], -values[i]);
|
||||
|
||||
Reference in New Issue
Block a user