Topic: Stream manipulators


Author: "Steve Wallace" <Wolruf@infinet.com>
Date: 1997/12/13
Raw View
are there any good examples of how to write manipulators for streams. What I
need to do is write a function that affects the entire stream. I want to
provide dynamic tab based spacing for custom types.

    cout <<"some text"<<sometype <<endl;
then sometypes << operator would look like this
    return s <<formatfunction <<1 <<endl;

and the output would look like..."some text    1" not "sometext1"

and it needs to track how many tabs it has so that nested format functions
would further tab over. even in other data type operators;
---
[ comp.std.c++ is moderated.  To submit articles: Try just posting with your
                newsreader.  If that fails, use mailto:std-c++@ncar.ucar.edu
  comp.std.c++ FAQ: http://reality.sgi.com/austern/std-c++/faq.html
  Moderation policy: http://reality.sgi.com/austern/std-c++/policy.html
  Comments? mailto:std-c++-request@ncar.ucar.edu
]