Skip to content

Conversation

@stweil
Copy link
Member

@stweil stweil commented Jul 6, 2025

No description provided.

Copy link
Contributor

@egorpugin egorpugin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some loops can be further improved with algorithms/ranges, but not insisting on changes

unsigned s = 0;
for (s = 0; s < allowed_scripts_->size(); ++s) {
if ((*allowed_scripts_)[s] == choice_script) {
for (auto script : *allowed_scripts_) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can be if (std::ranges::find(*allowed_scripts_, choice_script) != allowed_scripts_->end()) ...

for (const auto &result : results) {
const auto shape_id = result.shape_id;
const Shape &shape = shape_table.GetShape(shape_id);
if (shape.ContainsUnichar(unichar_id)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if (shape_table.GetShape(result.shape_id).ContainsUnichar(unichar_id)) {

also can be put inside std::ranges::find_if()

for (unsigned r = 0; r < results.size(); ++r) {
if (results[r].unichar_id == unichar_id) {
size_t r = 0;
for (const auto &result : results) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

std::ranges::find

@stweil stweil merged commit d3e50cf into main Jul 6, 2025
6 checks passed
@stweil
Copy link
Member Author

stweil commented Jul 6, 2025

Some loops can be further improved with algorithms/ranges, but not insisting on changes

Thanks for these suggestions which we can consider in later commits.

@stweil stweil deleted the modernize branch July 6, 2025 20:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants