diff --git a/include/bitcoin/system/define.hpp b/include/bitcoin/system/define.hpp index a41beced11..c47c3acf5a 100644 --- a/include/bitcoin/system/define.hpp +++ b/include/bitcoin/system/define.hpp @@ -79,16 +79,4 @@ namespace bc = libbitcoin; namespace libbitcoin { constexpr auto with_arm = false; }; #endif -/// Workarounds for C++ noncompliance. -/// --------------------------------------------------------------------------- - -/// C++17 (partial), see HAVE_EXECUTION. -#if defined(HAVE_EXECUTION) - namespace libbitcoin { constexpr auto par_unseq = std::execution::par_unseq; } - namespace libbitcoin { constexpr auto seq = std::execution::seq; } -#else - namespace libbitcoin { constexpr auto par_unseq = false; } - namespace libbitcoin { constexpr auto seq = false; } -#endif - #endif diff --git a/include/bitcoin/system/have.hpp b/include/bitcoin/system/have.hpp index ac4eccd62c..714e6fd6ac 100644 --- a/include/bitcoin/system/have.hpp +++ b/include/bitcoin/system/have.hpp @@ -204,16 +204,6 @@ #endif #endif -/// None on xcode. -/// Requires link with -ltbb on gcc (v9). -/// Experimental on clang (libcxx.llvm.org/Status/PSTL.html), requires: -/// -fexperimental-library -#if defined(HAVE_CPP17) - #if defined(HAVE_MSC) - #define HAVE_EXECUTION - #endif -#endif - /// These are manually configured here. /// --------------------------------------------------------------------------- diff --git a/include/bitcoin/system/impl/hash/scrypt.ipp b/include/bitcoin/system/impl/hash/scrypt.ipp index b18dd11de1..69b076ed20 100644 --- a/include/bitcoin/system/impl/hash/scrypt.ipp +++ b/include/bitcoin/system/impl/hash/scrypt.ipp @@ -45,9 +45,9 @@ CONSTEVAL auto& CLASS:: concurrency() NOEXCEPT { if constexpr (Concurrent) - return bc::par_unseq; + return poolstl::execution::par; else - return bc::seq; + return poolstl::execution::seq; } // protected @@ -499,7 +499,7 @@ CLASS::hash(data_array& out, const data_slice& password, // B[i] = scryptROMix (r, B[i], N) // end for std::atomic_bool success{ true }; - std_for_each(concurrency(), prblocks.begin(), prblocks.end(), + std::for_each(concurrency(), prblocks.begin(), prblocks.end(), [&](rblock_t& rblock) NOEXCEPT { success = success && romix(rblock); diff --git a/include/bitcoin/system/preprocessor.hpp b/include/bitcoin/system/preprocessor.hpp index ccade62d24..206c0d57ee 100644 --- a/include/bitcoin/system/preprocessor.hpp +++ b/include/bitcoin/system/preprocessor.hpp @@ -212,21 +212,12 @@ #define FALLTHROUGH [[fallthrough]] /// C++17 (partial) -#if defined(HAVE_EXECUTION) - #include - #define std_any_of(p, b, e, l) std::any_of((p), (b), (e), (l)) - #define std_all_of(p, b, e, l) std::all_of((p), (b), (e), (l)) - #define std_for_each(p, b, e, l) std::for_each((p), (b), (e), (l)) - #define std_reduce(p, b, e, i, l) std::reduce((p), (b), (e), (i), (l)) - #define std_transform(p, b, e, t, l) std::transform((p), (b), (e), (t), (l)) -#else - #include - #define std_any_of(p, b, e, l) std::any_of((b), (e), (l)) - #define std_all_of(p, b, e, l) std::all_of((b), (e), (l)) - #define std_for_each(p, b, e, l) std::for_each((b), (e), (l)) - #define std_reduce(p, b, e, i, l) std::reduce((b), (e), (i), (l)) - #define std_transform(p, b, e, t, l) std::transform((b), (e), (t), (l)) -#endif +/// None on xcode. +/// Requires link with -ltbb on gcc (v9). +/// Experimental on clang (libcxx.llvm.org/Status/PSTL.html), requires: +/// -fexperimental-library +/// using poolstl, do not include . +#include /// C++20 (partial) #if defined(HAVE_CONSTEVAL) diff --git a/test/hacks.cpp b/test/hacks.cpp index 4c521e17d6..1e90c47e1f 100644 --- a/test/hacks.cpp +++ b/test/hacks.cpp @@ -19,7 +19,7 @@ #include "test.hpp" #include -#if defined(DISABLED) && defined(HAVE_EXECUTION) +#if defined(DISABLED) BOOST_AUTO_TEST_SUITE(skip_parser_tests) @@ -274,7 +274,7 @@ BOOST_AUTO_TEST_CASE(skip_parser__skip_parse_concurrent_tx__factor__expected) for (size_t i = 0; i < factor; ++i) { - std::for_each(std::execution::par_unseq, jobs.begin(), jobs.end(), + std::for_each(poolstl::execution::par, jobs.begin(), jobs.end(), [&](const auto job) { if (job) @@ -299,7 +299,7 @@ BOOST_AUTO_TEST_CASE(skip_parser__skip_parse_concurrent_block__factor_txs__expec const auto expected1 = bitcoin_hash(tx_2); constexpr std_array jobs{}; - std::for_each(std::execution::par_unseq, jobs.begin(), jobs.end(), + std::for_each(poolstl::execution::par, jobs.begin(), jobs.end(), [&](const auto) { stream::in::copy input(tx_2); diff --git a/test/hash/hash.hpp b/test/hash/hash.hpp index f5a2f75379..7a3ffbf7e5 100644 --- a/test/hash/hash.hpp +++ b/test/hash/hash.hpp @@ -290,7 +290,7 @@ const auto sha_5 = data_chunk(1'000'000_size, to_byte('a')); constexpr auto alpha_count = 16'777'216_size; constexpr auto long_alpha_size = alpha_size * alpha_count; const auto alpha2 = to_array("abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmno"); - const std_vector long_alpha(alpha2_count, alpha2); + const std_vector long_alpha(alpha_count, alpha2); const auto long_alpha_data = pointer_cast(long_alpha.front().data()); const auto sha_6 = to_chunk(unsafe_array_cast(long_alpha_data)); #endif // !HAVE_SLOW_TESTS