Boost logo

Boost :

From: Gary Powell (Gary.Powell_at_[hidden])
Date: 2000-04-26 09:48:53


Let me first apologize for not begin clear....

 It's not the global stream that has the formatting problem, as Rüdiger
correctly points out.

  What I had envisioned was that "%1 %r%2 %3", would print the 2nd value
right justified, but not the 1st or 3rd. (They would have whatever stream
justifying existed before format was called.) I can see that the current
format doesn't really make that clear. Does the %r right justify for all
following arguments or just the next one. And if I want to reset it back to
the previous justifying, what was it?

This whole discussion is just because of my old printf days, not because its
correct.

basic_format(...) {
...
  ios_base const oldfmt(oss);
  while (...)
    case '1': put(a); oss.copyfmt(oldfmt); break;
   ...
}

Again, this is just my vision of this great tool.

-gary-
  

> -----Original Message-----
> From: Rüdiger Loos [SMTP:loos_at_[hidden]]
> Sent: Wednesday, April 26, 2000 7:01 AM
> To: boost_at_[hidden]
> Subject: RE: [boost] Re: Design discussion: easy i/o
>
> >
> > on 4/25/00 12:52 PM, Gary Powell at Gary.Powell_at_[hidden] wrote:
> >
> > > Also I was wondering if format should save the state of the iostream
> and
> > > reset it after formatting each value. More of the way that printf
> works. (In
> > > that centering one value doesn't leave the stream in a center all
> values
> > > state.)
> >
> > I didn't have a chance to notice that, but it certainly was one goal of
> my
> > original proposal to restore the stream state.
> >
> ...and it was one goal of my implementation. May be I'm wrong, but I don't
> see how
> the private ostringstream 'oss' of format can be influenced from the
> stream in which
> format is embedded. Vice versa, format passes a string to operator<< that
> does not
> affect the external stream state differently than any other string.
> Inside of format for EACH positional parameter width is initialized to 0
> and
> alignment to right (at the beginning of 'process'), what can be changed by
> %w.. or %l
> %c respectively. This (non-sticky) behavior cannot be overwritten by any
> other format
> parameters or parameters of the external stream - the state of which can't
> be
> influenecd by 'oss'.
> If I miss the point, please give me an example that does not work as
> intended.
> Rüdiger
>
>
> ------------------------------------------------------------------------
> IT Professionals: Match your unique skills with the best IT projects at
> http://click.egroups.com/1/3381/2/_/9351/_/956757656/
> ------------------------------------------------------------------------
>


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk