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

Function main

samples/table_dimensions.cpp:8–19  ·  view source on GitHub ↗

Demonstrates the fix for https://github.com/p-ranav/tabulate/issues/107: shape() measures the *rendered* table (character width x line count), not the logical row/column count. dimensions() gives the latter.

Source from the content-addressed store, hash-verified

6// shape() measures the *rendered* table (character width x line count), not
7// the logical row/column count. dimensions() gives the latter.
8int main() {
9 Table table;
10 table.add_row(Row_t{"cell"});
11
12 auto rendered = table.shape();
13 std::cout << "shape() [rendered width x height]: (" << rendered.first << ", " << rendered.second
14 << ")\n";
15
16 auto logical = table.dimensions();
17 std::cout << "dimensions() [rows x columns]: (" << logical.first << ", " << logical.second << ")"
18 << std::endl;
19}

Callers

nothing calls this directly

Calls 3

add_rowMethod · 0.45
shapeMethod · 0.45
dimensionsMethod · 0.45

Tested by

no test coverage detected