p-ranav / tabulate

Table Maker for Modern C++

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How do I initialize an n*m Table?

DGJGzy opened this issue · comments

commented

If only used add_row, it would be very difficult to initialize such a Table when n and m are variables.

I had a similar issue.
I found the mario example gave me my solution.

  Table table;
  for (size_t i = 0; i < rows; ++i) {
    Row_t row;
    for (size_t j = 0; j < cols; ++j) {
      row.push_back("");
    }
    table.add_row(row);
  }