mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
fix: remove include <ranges> (#4788)
Remove dependency on `<ranges>` 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
This commit is contained in:
@@ -27,17 +27,25 @@
|
||||
#include <ripple/protocol/jss.h>
|
||||
#include <test/jtx/Env.h>
|
||||
|
||||
#include <ranges>
|
||||
#include <vector>
|
||||
|
||||
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 <ranges> header. Replace with
|
||||
// `std::ranges::range<Input>`, and accordingly use std::ranges::begin/end
|
||||
// when we have moved to better compilers.
|
||||
template <typename Input>
|
||||
auto
|
||||
make_vector(auto const& input) requires std::ranges::range<decltype(input)>
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user