Boost logo

Boost :

From: Gennaro Prota (gennaro_prota_at_[hidden])
Date: 2003-03-12 07:56:45


On Tue, 11 Mar 2003 17:14:43 -0500, "Gennadiy Rozental"
<gennadiy.rozental_at_[hidden]> wrote:

> > * newl needs a bit more rationale. How is cout << newl different from
>cout
>> << '\n'? How is it better?
>
>Maybe newl does not reset the manipulators? If it true it should be spelled
>out explicitly. In any case I also like to see an example where newl is
>preferable to << '\n'.

Just to clarify a bit of confusion arisen in this thread:

neither std::endl nor the newl at hand reset the width; they both
behave as unformatted output functions. The difference between them is
just in the flush.

The difference between << 'n' and newl is precisely that the former is
a formatted output operation; since there's no special behavior for

  out << c

when c is a control character, << '\n', << 't', etc. work the same as,
let's say, << 'x'. As a side note, this means, for instance, that for
<< '\n' std::left/std::right actually seem something like
std::before/std::after :-)

Genny.


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