Optimize inserts in vector and refactor const reference objects (#659)

Signed-off-by: German Semenov <GermanAizek@yandex.ru>
Co-authored-by: ArthurSonzogni <sonzogniarthur@gmail.com>
This commit is contained in:
Herman Semenov
2023-05-31 20:24:08 +03:00
committed by GitHub
parent 8bea9261bc
commit d464a071da
10 changed files with 21 additions and 4 deletions

View File

@@ -37,6 +37,8 @@ class GridBox : public Node {
for (const auto& line : lines_) {
x_size = std::max(x_size, int(line.size()));
}
// Fill in empty cells, in case the user did not used the API correctly:
for (auto& line : lines_) {
while (line.size() < size_t(x_size)) {
line.push_back(filler());