From 574a62e66d865765f83fd9c8b3c18736495f16ed Mon Sep 17 00:00:00 2001 From: evoskuil Date: Tue, 28 Jan 2025 20:09:11 -0500 Subject: [PATCH] Remove obsolete workaround for lack of std::views::reverse. --- include/bitcoin/system/boost.hpp | 10 ---------- include/bitcoin/system/impl/radix/base_16.ipp | 3 ++- src/chain/block.cpp | 3 ++- src/chain/chain_state.cpp | 3 ++- 4 files changed, 6 insertions(+), 13 deletions(-) diff --git a/include/bitcoin/system/boost.hpp b/include/bitcoin/system/boost.hpp index 172aaf9433..e5c89bbfd1 100644 --- a/include/bitcoin/system/boost.hpp +++ b/include/bitcoin/system/boost.hpp @@ -55,16 +55,6 @@ ////#include // platform identifications #include -// C++20 suport for ranges not yet available on other platforms. -#if defined(HAVE_RANGES) - #include - #define views_reverse std::views::reverse -#else - // boost::adaptors::reverse is not constexpr. - #include - #define views_reverse boost::adaptors::reverse -#endif - // ADL free functions for use with boost-json. #define DECLARE_JSON_VALUE_CONVERTORS(name) \ BC_API name tag_invoke(boost::json::value_to_tag, \ diff --git a/include/bitcoin/system/impl/radix/base_16.ipp b/include/bitcoin/system/impl/radix/base_16.ipp index 17a87f7705..b2f5c60b3f 100644 --- a/include/bitcoin/system/impl/radix/base_16.ipp +++ b/include/bitcoin/system/impl/radix/base_16.ipp @@ -20,6 +20,7 @@ #define LIBBITCOIN_SYSTEM_RADIX_BASE_16_IPP #include +#include #include #include #include @@ -116,7 +117,7 @@ SRCONSTEXPR std::string encode_hash(const data_slice& hash) NOEXCEPT auto digit = out.begin(); // views_reverse is RCONSTEXPR - for (const auto byte: views_reverse(hash)) + for (const auto byte: std::views::reverse(hash)) { *digit++ = to_base16_character(shift_right(byte, to_half(byte_bits))); *digit++ = to_base16_character(bit_and(byte, 0x0f_u8)); diff --git a/src/chain/block.cpp b/src/chain/block.cpp index 33dff1d784..31c05c7f5a 100644 --- a/src/chain/block.cpp +++ b/src/chain/block.cpp @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -619,7 +620,7 @@ bool block::is_invalid_witness_commitment() const NOEXCEPT // Last output of commitment pattern holds the committed value (bip141). hash_digest reserved{}, committed{}; if (coinbase->inputs_ptr()->front()->reserved_hash(reserved)) - for (const auto& output: views_reverse(*coinbase->outputs_ptr())) + for (const auto& output: std::views::reverse(*coinbase->outputs_ptr())) if (output->committed_hash(committed)) if (committed == sha256::double_hash( generate_merkle_root(true), reserved)) diff --git a/src/chain/chain_state.cpp b/src/chain/chain_state.cpp index 57f5f307aa..9b9b417751 100644 --- a/src/chain/chain_state.cpp +++ b/src/chain/chain_state.cpp @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include @@ -451,7 +452,7 @@ uint32_t chain_state::easy_work_required(const data& values, const auto& bits = values.bits.ordered; // Reverse iterate the ordered-by-height list of header bits. - for (auto bit: views_reverse(bits)) + for (auto bit: std::views::reverse(bits)) { if (is_retarget_or_non_limit(--height, bit, retargeting_interval, proof_of_work_limit))