Skip to content

Commit

Permalink
Add const attribute to several compare operators
Browse files Browse the repository at this point in the history
Signed-off-by: Stefan Weil <[email protected]>
  • Loading branch information
stweil committed Nov 19, 2022
1 parent 1751fba commit 4c0051d
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/ccstruct/points.h
Original file line number Diff line number Diff line change
Expand Up @@ -269,11 +269,11 @@ class TESS_API FCOORD {
bool normalise();

/// test equality
bool operator==(const FCOORD &other) {
bool operator==(const FCOORD &other) const {
return xcoord == other.xcoord && ycoord == other.ycoord;
}
/// test inequality
bool operator!=(const FCOORD &other) {
bool operator!=(const FCOORD &other) const {
return xcoord != other.xcoord || ycoord != other.ycoord;
}
/// rotate 90 deg anti
Expand Down
2 changes: 1 addition & 1 deletion src/ccutil/params.h
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ class StringParam : public Param {
bool empty() const {
return value_.empty();
}
bool operator==(const std::string &other) {
bool operator==(const std::string &other) const {
return value_ == other;
}
void operator=(const std::string &value) {
Expand Down
2 changes: 1 addition & 1 deletion src/dict/dawg.h
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ struct DawgPosition {
dawg_index(dawg_idx),
punc_index(punc_idx),
back_to_punc(backtopunc) {}
bool operator==(const DawgPosition &other) {
bool operator==(const DawgPosition &other) const {
return dawg_index == other.dawg_index && dawg_ref == other.dawg_ref &&
punc_index == other.punc_index && punc_ref == other.punc_ref &&
back_to_punc == other.back_to_punc;
Expand Down
2 changes: 1 addition & 1 deletion src/lstm/recodebeam.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ void RecodeBeamSearch::ExtractBestPathAsWords(const TBOX &line_box,
}

struct greater_than {
inline bool operator()(const RecodeNode *&node1, const RecodeNode *&node2) {
inline bool operator()(const RecodeNode *&node1, const RecodeNode *&node2) const {
return (node1->score > node2->score);
}
};
Expand Down

0 comments on commit 4c0051d

Please sign in to comment.