MCPcopy Create free account
hub / github.com/p-ranav/tabulate / make_long_text_table

Function make_long_text_table

samples/benchmark.cpp:255–266  ·  view source on GitHub ↗

Builds a rows x cols table where every cell holds a long sentence that won't fit on one line at any reasonably narrow column width, used by the word-wrap benchmarks below. Varying row/column content keeps every cell text distinct (closer to real data than repeating the same string).

Source from the content-addressed store, hash-verified

253// word-wrap benchmarks below. Varying row/column content keeps every cell
254// text distinct (closer to real data than repeating the same string).
255Table make_long_text_table(int rows, int cols) {
256 Table table;
257 for (int r = 0; r < rows; ++r) {
258 Row_t row;
259 for (int c = 0; c < cols; ++c)
260 row.push_back("This is a much longer piece of cell content for row " + std::to_string(r) +
261 " column " + std::to_string(c) +
262 " that will not fit on one line and must be word-wrapped properly");
263 table.add_row(row);
264 }
265 return table;
266}
267
268// ============================================================================
269// 4a. Word-wrap scaling: for each rows x cols size, compare a table of short,

Callers 2

Calls 2

to_stringFunction · 0.50
add_rowMethod · 0.45

Tested by

no test coverage detected