Use ranges
C++20 brought us std::ranges for a lot of algorithms. Most of these
conversions were done using comby, similar to:
```
comby -verbose 'std::lower_bound(:[a].begin(),:[b].end(),:[c])' 'std::ranges::lower_bound(:[a], :[c])' $(git ls-files | grep "\.[hc]\(pp\)\?$") -in-place
```
Change-Id: I0c99c04e9368312555c08147d474ca93a5959e8d
Signed-off-by: Ed Tanous <edtanous@google.com>
diff --git a/redfish-core/lib/task.hpp b/redfish-core/lib/task.hpp
index 8a5c30b..40e1a51 100644
--- a/redfish-core/lib/task.hpp
+++ b/redfish-core/lib/task.hpp
@@ -32,6 +32,7 @@
#include <chrono>
#include <memory>
+#include <ranges>
#include <variant>
namespace redfish
@@ -67,8 +68,8 @@
for (const auto& field : req.fields())
{
- if (std::find(headerWhitelist.begin(), headerWhitelist.end(),
- field.name()) == headerWhitelist.end())
+ if (std::ranges::find(headerWhitelist, field.name()) ==
+ headerWhitelist.end())
{
continue;
}
@@ -336,8 +337,8 @@
{
return;
}
- auto find = std::find_if(
- task::tasks.begin(), task::tasks.end(),
+ auto find = std::ranges::find_if(
+ task::tasks,
[&strParam](const std::shared_ptr<task::TaskData>& task) {
if (!task)
{
@@ -377,8 +378,8 @@
{
return;
}
- auto find = std::find_if(
- task::tasks.begin(), task::tasks.end(),
+ auto find = std::ranges::find_if(
+ task::tasks,
[&strParam](const std::shared_ptr<task::TaskData>& task) {
if (!task)
{