From 65346dc54d5326786b3ff055a14eadef2104fb81 Mon Sep 17 00:00:00 2001 From: Bronek Kozicki Date: Wed, 25 Oct 2023 18:07:18 +0000 Subject: [PATCH 1/3] Remove include --- src/test/jtx/TestHelpers.h | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/test/jtx/TestHelpers.h b/src/test/jtx/TestHelpers.h index 2bee47a6411..7b4cae51554 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 +template +concept iterable = requires(T& v) { + std::begin(v); + std::end(v); + }; + +template auto -make_vector(auto const& input) requires std::ranges::range +make_vector(Input const& input) + requires iterable { - return std::vector(std::ranges::begin(input), std::ranges::end(input)); + return std::vector(std::begin(input), std::end(input)); } // Functions used in debugging From ee53c5ddff12b94b67c41361838ba93002da02a3 Mon Sep 17 00:00:00 2001 From: Bronek Kozicki Date: Wed, 25 Oct 2023 18:17:10 +0000 Subject: [PATCH 2/3] Formatting fix --- src/test/jtx/TestHelpers.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/test/jtx/TestHelpers.h b/src/test/jtx/TestHelpers.h index 7b4cae51554..61d0eb87f9f 100644 --- a/src/test/jtx/TestHelpers.h +++ b/src/test/jtx/TestHelpers.h @@ -35,15 +35,15 @@ namespace jtx { // Helper to make vector from iterable template -concept iterable = requires(T& v) { - std::begin(v); - std::end(v); - }; +concept iterable = requires(T& v) +{ + std::begin(v); + std::end(v); +}; template auto -make_vector(Input const& input) - requires iterable +make_vector(Input const& input) requires iterable { return std::vector(std::begin(input), std::end(input)); } From 5b425a52ca09b6aa95d0e8d514c2831c467c1702 Mon Sep 17 00:00:00 2001 From: Bronek Kozicki Date: Mon, 30 Oct 2023 15:24:37 +0000 Subject: [PATCH 3/3] Remove named concept iterable --- src/test/jtx/TestHelpers.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/test/jtx/TestHelpers.h b/src/test/jtx/TestHelpers.h index 61d0eb87f9f..b065cec470a 100644 --- a/src/test/jtx/TestHelpers.h +++ b/src/test/jtx/TestHelpers.h @@ -33,17 +33,17 @@ namespace ripple { namespace test { namespace jtx { -// Helper to make vector from iterable -template -concept iterable = requires(T& v) +// 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(Input const& input) requires requires(Input& v) { std::begin(v); std::end(v); -}; - -template -auto -make_vector(Input const& input) requires iterable +} { return std::vector(std::begin(input), std::end(input)); }