What you want to do is create a template that can output any print sequence, that is, a sequence of printable elements. You should also be able to customize how you start, end, and limit the sequence.
Create your own wrapper class. Now, since this is your shell, you can overload the <<operator happily on it without interfering with the external namespace.
You can use boost :: range in your constructor, or templated being / end sequence or templated collection.
Also take your separators as parameters. You can have reasonable defaults if you want,
Finally, when you want to print one, you simply do something like:
std::cout << MySequenceFormatter( seq.begin(), seq.end(), delim, startofSeq, endOfSeq ) << std::endl;
When displaying cards, you can use boost :: transform_iterator between them to convert each std :: pair when repeating a sequence. Then you can also have your own format. In fact, you can do this for any sequence in which you want to use your own method to print the elements themselves.
source share