Skip to content

Commit

Permalink
Replace at accessor by [] operator in function Classify::CreateIntTem…
Browse files Browse the repository at this point in the history
…plates

UnicityTable did not provide the [] operator, so add it for this change.

Suggested-by: Egor Pugin <[email protected]>
Signed-off-by: Stefan Weil <[email protected]>
  • Loading branch information
stweil committed Dec 12, 2022
1 parent c7477f5 commit f4ca51c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 7 additions & 0 deletions src/ccutil/unicity_table.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,13 @@ class UnicityTable {
return table_.at(id);
}

T &operator[](size_t id) {
return table_[id];
}
const T &operator[](size_t id) const {
return table_[id];
}

/// Return the id of the T object.
/// This method NEEDS a compare_callback to be passed to
/// set_compare_callback.
Expand Down
2 changes: 1 addition & 1 deletion src/classify/intproto.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,7 @@ INT_TEMPLATES_STRUCT *Classify::CreateIntTemplates(CLASSES FloatProtos,
FontSet fs;
fs.reserve(fs_size);
for (unsigned i = 0; i < fs_size; ++i) {
fs.push_back(FClass->font_set.at(i));
fs.push_back(FClass->font_set[i]);
}
IClass->font_set_id = this->fontset_table_.push_back(fs);
AddIntClass(IntTemplates, ClassId, IClass);
Expand Down

0 comments on commit f4ca51c

Please sign in to comment.