Skip to content

Commit

Permalink
Use std::ranges in a couple more places
Browse files Browse the repository at this point in the history
  • Loading branch information
jmcarcell committed Oct 18, 2024
1 parent 2693187 commit 5eb39e2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/DatamodelRegistry.cc
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ size_t DatamodelRegistry::registerDatamodel(std::string name, std::string_view d
}

// TODO: Output?
return std::distance(m_definitions.cbegin(), it);
return std::ranges::distance(m_definitions.cbegin(), it);
}

size_t DatamodelRegistry::registerDatamodel(std::string name, std::string_view definition,
Expand Down
4 changes: 2 additions & 2 deletions tests/unittests/frame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ TEST_CASE("Frame parameters", "[frame][basics]") {
const auto stringKeys = event.getParameterKeys<std::string>();
REQUIRE(stringKeys.size() == 2);
// Can't rely on an insertion order here
REQUIRE(std::find(stringKeys.begin(), stringKeys.end(), "aString") != stringKeys.end());
REQUIRE(std::find(stringKeys.begin(), stringKeys.end(), "someStrings") != stringKeys.end());
REQUIRE(std::ranges::find(stringKeys, "aString") != stringKeys.end());
REQUIRE(std::ranges::find(stringKeys, "someStrings") != stringKeys.end());
}

// NOTE: Due to the extremely small tasks that are done in these tests, they will
Expand Down

0 comments on commit 5eb39e2

Please sign in to comment.