|
Boost : |
From: Dietmar Kuehl (dietmar_kuehl_at_[hidden])
Date: 2000-03-07 11:21:36
Hi,
--- Dave Abrahams <abrahams_at_[hidden]> wrote:
> s << std::endl is actually equivalent to s.put(s.widen('\n'), s.flush
>
> Does a wide stream automatically properly widen chars which are
> streamed in?
Yes, it does.
> 27.6.2.5.4 seems to say that it does.
There are more sections than this involved :-) For example, those in
the numeric formatting description. Of course, for the purpose of just
writing "\n" the cited paragraph is the important one.
Concerning the format string stuff we have seen several implementations
by now. However, I was missing the possibility to extend the format
strings by user defined formating flags. IOStreams have the possibility
to set up user defined formating flags using the 'pword()'/'iword()'
mechanism. I can image that it would be useful to allow something
similar. Now, how is this intended to work? Actually, quite simple: If
an object is to be formatted, the object and the corresponding format
is passed to a function which is supposed to print the object. The
default implementation just calls 'operator<<()' for the object after
"normal" setup of the flags. A replacement version can do more fancy
things.
The only problem is that the parser for the format string somehow has
to know where the format string ends! Inventing completely new format
strings this would be simple: Eg. a format specification could be a %
followed by all characters until a ;. Unfortunately, most people
probably would like to use printf() format specifiers for the built-in
types (although normally they don't get them correct, at least not if
comes down to input).
Does anybody else think that this would be useful?
__________________________________________________
Do You Yahoo!?
Talk to your friends online with Yahoo! Messenger.
http://im.yahoo.com
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk