In article <579e850e-f681-4863-b286-
XXXX@XXXXX.COM >, XXXX@XXXXX.COM says...
[ ... ]
That's exactly how things work now, except that the names are different.
A stream buffer knows only about reading/writing streams of characters.
A stream is a formatting class that's attached to a stream buffer that
acts as its source or sink -- but all the stream itself does is
format/parse data going to/coming from the stream buffer.
Now, there does appear to be one basic difference: you'd (apparently)
like to create a formatting object on the fly, feed it all the
formatting flags, have it format an object, and then destroy that
object. By contrast, the iostreams classes are designed so the
formatting object is more more permanent, and with at least some
capability to store formatting information in the longer term.
Your alternative is certainly a viable possibility, but you should be
aware that 1) it's primarily a difference in degree rather than kind --
i.e. while it's _typical_ to create a stream and allow it to create a
stream buffer, it's entirely possible to create a stream buffer, then
attach stream objects to that stream buffer as you see fit, each (for
example) with a separate set of format flags, and 2) that your setup is
likely to require careful design to get good efficiency -- in
particular, since you're likely to create and destroy a lot of
formatting objects, you need to be sure doing so is fairly inexpensive.
An ideal output would
The moment you do this, you have basically nothing more or less than a
mediocre imitation of the current iostreams architecture -- i.e. you've
taken the current architecture, but rather than its clean separation of
formatting from buffering, you advocate something that's supposed to be
a buffer, only it knows about _some_ default formatting...
Quite the contrary: you've advocated virtually nothing that's not
already available via iostreams, but your idea:
1) has a poorly defined architecture, mixing some formatting
responsibility into the buffer class.
2) will require very careful design to avoid even worse efficiency from
the number of formatting objects you create and destroy.
--
Later,
Jerry.
The universe is a figment of its own imagination.
[ See http://www.**--****.com/ ]
[ comp.lang.c++.moderated. First time posters: Do this! ]