From 5ceffcc7c5149d65fbd07ad93e2f3ffa32a98023 Mon Sep 17 00:00:00 2001 From: Tony Gorez Date: Fri, 4 Oct 2024 17:25:49 +0200 Subject: [PATCH] refactor(walker): use std::ranges:sort instead of std::sort (#1267) Clang tidy recommandation Signed-off-by: Tony Gorez --- src/jsonschema/walker.cc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/jsonschema/walker.cc b/src/jsonschema/walker.cc index 1119bc19f..23856cfde 100644 --- a/src/jsonschema/walker.cc +++ b/src/jsonschema/walker.cc @@ -2,9 +2,10 @@ #include #include -#include // std::max, std::sort +#include // std::max #include // assert #include // std::accumulate +#include // std::ranges::sort auto sourcemeta::jsontoolkit::keyword_priority( std::string_view keyword, const std::map &vocabularies, @@ -207,8 +208,8 @@ sourcemeta::jsontoolkit::SchemaKeywordIterator::SchemaKeywordIterator( } // Sort keywords based on priority for correct evaluation - std::sort( - this->entries.begin(), this->entries.end(), + std::ranges::sort( + this->entries, [&vocabularies, &walker](const auto &left, const auto &right) -> bool { // These cannot be empty or indexes, as we created // the entries array from a JSON object