【发布时间】:2011-05-27 04:22:29
【问题描述】:
我正在寻找一个类似于 prettytable 但在 C++ 中的库
http://code.google.com/p/prettytable/
我知道如何使用 printf 或 iostream 自己生成一个。但是,我想知道是否有这个库。
我只对将这个 ASCII 表写入控制台感兴趣。
最好是这样的:
std::vector<std::string> headers;
headers.push_back("My Awesome Header 1");
headers.push_back("My Awesome Header 2");
headers.push_back("My Awesome Header 3");
PrettyTablePrinter ptp;
ptp.SetHeaders(headers);
// Set some other options here
ptp.AddRow(data[0]);
ptp.AddRow(data[1]);
ptp.AddRow(data[2]);
ptp.Print(&std::cout);
【问题讨论】:
标签: c++ pretty-print