Skip to content

Commit 97ec97e

Browse files
committed
fix: replace <ranges> usage with standard alternatives (std::transform, std::any_of)
1 parent db8985a commit 97ec97e

2 files changed

Lines changed: 3 additions & 5 deletions

File tree

include/endstone/command/command.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
#pragma once
1616

1717
#include <algorithm>
18-
#include <ranges>
1918
#include <string>
2019
#include <utility>
2120
#include <vector>
@@ -73,7 +72,7 @@ class Command {
7372
void setName(std::string name)
7473
{
7574
if (!isRegistered()) {
76-
std::ranges::transform(name, name.begin(), [](unsigned char c) { return std::tolower(c); });
75+
std::transform(name.begin(), name.end(), name.begin(), [](unsigned char c) { return std::tolower(c); });
7776
name_ = std::move(name);
7877
}
7978
}
@@ -195,7 +194,7 @@ class Command {
195194
return true;
196195
}
197196

198-
return std::ranges::any_of(permissions_, [&target](const auto &p) { return target.hasPermission(p); });
197+
return std::any_of(permissions_.begin(), permissions_.end(), [&target](const auto &p) { return target.hasPermission(p); });
199198
}
200199

201200
/**

include/endstone/permissions/permission.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616

1717
#include <algorithm>
1818
#include <memory>
19-
#include <ranges>
2019
#include <string>
2120
#include <unordered_map>
2221
#include <unordered_set>
@@ -145,7 +144,7 @@ class Permission {
145144
if (!plugin_manager_) {
146145
return nullptr;
147146
}
148-
std::ranges::transform(name, name.begin(), [](unsigned char c) { return std::tolower(c); });
147+
std::transform(name.begin(), name.end(), name.begin(), [](unsigned char c) { return std::tolower(c); });
149148
auto *perm = plugin_manager_->getPermission(name);
150149
if (!perm) {
151150
perm = &plugin_manager_->addPermission(std::make_unique<Permission>(name));

0 commit comments

Comments
 (0)