|
Boost : |
Subject: Re: [boost] [iostreams]ANNOUNCE:indent_filtering_ostream.zip in vault
From: dherring_at_[hidden]
Date: 2010-01-13 15:16:43
On Wed, 13 Jan 2010, Larry Evans wrote:
> On 01/13/10 13:46, Larry Evans wrote:
> [snip]
>> IIRC, the last element printed in a struct has no trailing
>> nl. The task of appending the nl is left to the caller. This
>> protocol is illustrated by the attachment,
>
> Actually, the new attachment looks remarkably similar to your's
> except, instead of:
>
> << nl << element << "\n";
>
> there's:
>
> << "\n" << element;
>
> and there's no special case to test for the last element.
> IOW, the newlines prefix each element on the
> statement instead of trail each element.
Yes, newline prefix is preferred when newlines trigger indentation.
I'll try to get a more detailed reply; but time's tight right now. One
thing to note: my previous example was meant to show the problem with
mixing prefix and postfix newlines. The following output shows the value
of a newline without indentation.
"
namespace N
{
struct S1
{
int x;
};
struct S2
{ ... };
}
"
Note the blank line between S1 and S2.
- Daniel
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk