From 6c88694a2943b7c1d5ca5c9a5c5dd1738a69c36b Mon Sep 17 00:00:00 2001 From: Bronek Kozicki Date: Mon, 30 Oct 2023 18:13:25 +0000 Subject: [PATCH] fix: remove include (#4788) Remove dependency on `` header, since it is not implemented by all compilers which we want to support. This code change only affects unit tests. Resolve https://github.com/XRPLF/rippled/issues/4787 --- src/test/jtx/TestHelpers.h | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/test/jtx/TestHelpers.h b/src/test/jtx/TestHelpers.h index 2bee47a6411..b065cec470a 100644 --- a/src/test/jtx/TestHelpers.h +++ b/src/test/jtx/TestHelpers.h @@ -27,17 +27,25 @@ #include #include -#include +#include namespace ripple { namespace test { namespace jtx { -// Helper to make vector from iterable +// TODO We only need this long "requires" clause as polyfill, for C++20 +// implementations which are missing header. Replace with +// `std::ranges::range`, and accordingly use std::ranges::begin/end +// when we have moved to better compilers. +template auto -make_vector(auto const& input) requires std::ranges::range +make_vector(Input const& input) requires requires(Input& v) { - return std::vector(std::ranges::begin(input), std::ranges::end(input)); + std::begin(v); + std::end(v); +} +{ + return std::vector(std::begin(input), std::end(input)); } // Functions used in debugging