Skip to content

Commit 574a62e

Browse files
committed
Remove obsolete workaround for lack of std::views::reverse.
1 parent aa8a735 commit 574a62e

4 files changed

Lines changed: 6 additions & 13 deletions

File tree

include/bitcoin/system/boost.hpp

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -55,16 +55,6 @@
5555
////#include <boost/predef.h> // platform identifications
5656
#include <boost/program_options.hpp>
5757

58-
// C++20 suport for ranges not yet available on other platforms.
59-
#if defined(HAVE_RANGES)
60-
#include <ranges>
61-
#define views_reverse std::views::reverse
62-
#else
63-
// boost::adaptors::reverse is not constexpr.
64-
#include <boost/range/adaptor/reversed.hpp>
65-
#define views_reverse boost::adaptors::reverse
66-
#endif
67-
6858
// ADL free functions for use with boost-json.
6959
#define DECLARE_JSON_VALUE_CONVERTORS(name) \
7060
BC_API name tag_invoke(boost::json::value_to_tag<name>, \

include/bitcoin/system/impl/radix/base_16.ipp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#define LIBBITCOIN_SYSTEM_RADIX_BASE_16_IPP
2121

2222
#include <algorithm>
23+
#include <ranges>
2324
#include <string>
2425
#include <string_view>
2526
#include <bitcoin/system/data/data.hpp>
@@ -116,7 +117,7 @@ SRCONSTEXPR std::string encode_hash(const data_slice& hash) NOEXCEPT
116117
auto digit = out.begin();
117118

118119
// views_reverse is RCONSTEXPR
119-
for (const auto byte: views_reverse(hash))
120+
for (const auto byte: std::views::reverse(hash))
120121
{
121122
*digit++ = to_base16_character(shift_right(byte, to_half(byte_bits)));
122123
*digit++ = to_base16_character(bit_and(byte, 0x0f_u8));

src/chain/block.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#include <iterator>
2323
#include <memory>
2424
#include <numeric>
25+
#include <ranges>
2526
#include <set>
2627
#include <type_traits>
2728
#include <utility>
@@ -619,7 +620,7 @@ bool block::is_invalid_witness_commitment() const NOEXCEPT
619620
// Last output of commitment pattern holds the committed value (bip141).
620621
hash_digest reserved{}, committed{};
621622
if (coinbase->inputs_ptr()->front()->reserved_hash(reserved))
622-
for (const auto& output: views_reverse(*coinbase->outputs_ptr()))
623+
for (const auto& output: std::views::reverse(*coinbase->outputs_ptr()))
623624
if (output->committed_hash(committed))
624625
if (committed == sha256::double_hash(
625626
generate_merkle_root(true), reserved))

src/chain/chain_state.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#include <algorithm>
2222
#include <chrono>
2323
#include <iterator>
24+
#include <ranges>
2425
#include <bitcoin/system/chain/block.hpp>
2526
#include <bitcoin/system/chain/chain_state.hpp>
2627
#include <bitcoin/system/chain/checkpoint.hpp>
@@ -451,7 +452,7 @@ uint32_t chain_state::easy_work_required(const data& values,
451452
const auto& bits = values.bits.ordered;
452453

453454
// Reverse iterate the ordered-by-height list of header bits.
454-
for (auto bit: views_reverse(bits))
455+
for (auto bit: std::views::reverse(bits))
455456
{
456457
if (is_retarget_or_non_limit(--height, bit, retargeting_interval,
457458
proof_of_work_limit))

0 commit comments

Comments
 (0)