From 3e5b2760ab83b3801a613dadd5cc039c4651e2f0 Mon Sep 17 00:00:00 2001 From: Stefan Weil Date: Tue, 23 Feb 2021 20:34:41 +0100 Subject: [PATCH] Replace GenericVector by std::vector for struct BlamerBundle Signed-off-by: Stefan Weil --- src/ccstruct/blamer.cpp | 4 ++-- src/ccstruct/blamer.h | 15 ++++++++------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/ccstruct/blamer.cpp b/src/ccstruct/blamer.cpp index 0bf720fd..ecaf012f 100644 --- a/src/ccstruct/blamer.cpp +++ b/src/ccstruct/blamer.cpp @@ -134,8 +134,8 @@ void BlamerBundle::FillDebugString(const STRING &msg, const WERD_CHOICE *choice, STRING *debug) { (*debug) += "Truth "; - for (int i = 0; i < this->truth_text_.size(); ++i) { - (*debug) += this->truth_text_[i]; + for (auto& text : this->truth_text_) { + (*debug) += text; } if (!this->truth_has_char_boxes_) (*debug) += " (no char boxes)"; if (choice != nullptr) { diff --git a/src/ccstruct/blamer.h b/src/ccstruct/blamer.h index 2d0b6198..769ac467 100644 --- a/src/ccstruct/blamer.h +++ b/src/ccstruct/blamer.h @@ -31,12 +31,12 @@ #include "rect.h" // for TBOX #include "tprintf.h" // for tprintf -#include "genericvector.h" // for GenericVector -#include // for UNICHAR_ID +#include // for UNICHAR_ID #include "strngs.h" // for STRING #include // for int16_t #include // for memcpy +#include // for std::vector namespace tesseract { @@ -119,8 +119,9 @@ struct BlamerBundle { // Accessors. STRING TruthString() const { STRING truth_str; - for (int i = 0; i < truth_text_.size(); ++i) - truth_str += truth_text_[i]; + for (auto& text : truth_text_) { + truth_str += text; + } return truth_str; } IncorrectResultReason incorrect_result_reason() const { @@ -326,7 +327,7 @@ struct BlamerBundle { // (filled in by WERD_RES::SetupForRecognition()). tesseract::BoxWord norm_truth_word_; // Contains ground truth unichar for each of the bounding boxes in truth_word. - GenericVector truth_text_; + std::vector truth_text_; // The reason for incorrect OCR result. IncorrectResultReason incorrect_result_reason_; // Debug text associated with the blame. @@ -335,8 +336,8 @@ struct BlamerBundle { STRING misadaption_debug_; // Vectors populated by SegSearch to indicate column and row indices that // correspond to blobs with correct bounding boxes. - GenericVector correct_segmentation_cols_; - GenericVector correct_segmentation_rows_; + std::vector correct_segmentation_cols_; + std::vector correct_segmentation_rows_; // Best rating for correctly segmented path // (set and used by SegSearch when looking for blame). float best_correctly_segmented_rating_;