| 1502 | |
| 1503 | |
| 1504 | void print_table(string title, vector<tuple<string, string>> rows, string indent) { |
| 1505 | |
| 1506 | // only root node prints |
| 1507 | if (!comm_isRootNode()) |
| 1508 | return; |
| 1509 | |
| 1510 | // find max-width of left column |
| 1511 | size_t maxWidth = 0; |
| 1512 | for (auto const& [key, value] : rows) { |
| 1513 | if (key.length() > maxWidth) |
| 1514 | maxWidth = key.length(); |
| 1515 | |
| 1516 | // pedantically suppressing unused-variable warning |
| 1517 | // (while still mirroring below enumeration for clarity) |
| 1518 | (void) value; |
| 1519 | } |
| 1520 | |
| 1521 | // print table title (indented) |
| 1522 | cout << indent << getTableTitleStr(title) << endl; |
| 1523 | |
| 1524 | // pad left column (which is doubly indented) to align right column |
| 1525 | for (auto const& [key, value] : rows) |
| 1526 | cout |
| 1527 | << indent << indent << left |
| 1528 | << setw(maxWidth + MIN_SPACE_BETWEEN_TABLE_COLS) << setfill(TABLE_SPACE_CHAR) |
| 1529 | << key << value << endl; |
| 1530 | } |
| 1531 | |
| 1532 | |
| 1533 | void print_table(string title, vector<tuple<string, long long int>> rows, string indent) { |
no test coverage detected