【发布时间】:2017-04-26 20:50:35
【问题描述】:
这是Kerrek SB 等上一个关于漂亮打印 STL 容器Pretty-print C++ STL containers 的问题的后续,Kerrek 等设法为此开发了一个非常优雅且完全通用的解决方案,以及它的续集Pretty-print std::tuple,其中std::tuple<Args...> 已处理。
我想知道是否可以在有关缩进的解决方案中加入?
例如,如果我有一个字符串向量的向量,我希望看到类似的内容:
{ // vector of vector of vector of string
{ // vector of vector of string
{ hello, world };// vector of string
{ The, quick, brown, fox, jumps, over, the, lazy, dog };
...
{ Now, is, the, time, for, all, good, men, to, come, to, the, aid, of, the, party}
};
{ // vector of vector of string
{ hello, world };// vector of string
{ The, quick, brown, fox, jumps, over, the, lazy, dog };
...
{ Now, is, the, time, for, all, good, men, to, come, to, the, aid, of, the, party}
};
...
{ // vector of vector of string
{ hello, world };// vector of string
{ The, quick, brown, fox, jumps, over, the, lazy, dog };
...
{ Now, is, the, time, for, all, good, men, to, come, to, the, aid, of, the, party}
};
}
怎样才能做得很好?
【问题讨论】:
标签: c++ c++11 templates pretty-print