Chapter 34. An Enhanced ostream_iterator

 

I have benefited greatly from criticism, and at no time have I suffered a lack thereof.

 
 --Winston Churchill
 

I’m so gorgeous, there’s a six-month waiting list for birds to suddenly appear, every time I am near!

 
 --Cat, Red Dwarf

Introduction

Do you ever find yourself wanting to output the contents of a sequence where the elements are to be indented, perhaps by a tab space ('\t'), as in the following example?

Header Files:
    H:\freelibs\b64\current\include\b64\b64.h
    H:\freelibs\b64\current\include\b64\cpp\b64.hpp
Implementation Files:
    H:\freelibs\b64\current\src\b64.c
    H:\freelibs\b64\current\test\C\C.c
    H:\freelibs\b64\current\test\Cpp\Cpp.cpp

Using std::ostream_iterator, this is disproportionately difficult and ...

Get Extended STL, Volume 1: Collections and Iterators now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.