Skip to content

friedmud/variadic_table

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

44 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

VariadicTable

Used for "pretty-printing" a formatted table of data to the console.

It uses "variadic templates" to allow you to specify the types of data in each column.

Example Usage

#include "VariadicTable.h"

VariadicTable<std::string, double, int, std::string> vt({"Name", "Weight", "Age", "Brother"}, 10);

vt.addRow("Cody", 180.2, 40, "John");
vt.addRow("David", 175.3, 38, "Andrew");
vt.addRow("Robert", 140.3, 27, "Fande");

vt.print(std::cout);

Outputs:

------------------------------------------------
|  Name  |   Weight   |     Age    |  Brother  |
------------------------------------------------
| Cody   |      180.2 |         40 | John      |
| David  |      175.3 |         38 | Andrew    |
| Robert |      140.3 |         27 | Fande     |
------------------------------------------------

For more usage examples see main.C.

Installation

Just put VariadicTable.h somewhere and #include "VariadicTable.h"

Compilation

You don't need to compile this - but a simple make should work to build the main.C provided here so you can see the example usage.

About

Formatted Table For Printing To Console

Resources

License

Stars

110 stars

Watchers

2 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors