Simple Table Creation
Create a basic table by instantiating aTable object and adding rows with the addRow() method. Each call to addRow() takes an initializer list of strings representing the columns.
+, -, | characters), showing the country names in the first column and their capitals in the second column.
Adding Multiple Rows
TheaddRow() method returns a reference to the table, allowing for method chaining. This makes it easy to build tables with multiple rows in a fluent interface style.
Rendering Tables
Tabular provides two methods for outputting tables:- Cross-Platform Rendering
- Standard Output
Use This method ensures proper handling of multibyte characters across different terminal emulators.
render() from tabular/render.h for cross-platform support, especially when working with Unicode characters:Accessing Table Elements
You can access and modify specific cells in your table using the[] operator:
Setting Table Width
By default, tables have a width of 50 characters. You can change this using thewidth() configuration:
std::runtime_exception will be thrown with the estimated minimum width.