Boost logo

Boost :

From: Rob Stewart (stewart_at_[hidden])
Date: 2004-08-31 11:59:55

From: Daryle Walker <darylew_at_[hidden]>
> On 8/27/04 12:42 PM, "Rob Stewart" <stewart_at_[hidden]> wrote:
> > From: "Jonathan Turkanis" <technews_at_[hidden]>
> >> "Rob Stewart" <stewart_at_[hidden]> wrote in message
> >>
> >>> From: "Jonathan Turkanis" <technews_at_[hidden]>
> [SNIP]
> >>>> - multi_newer: How often do you need to write multiple copies of a
> >>>> character to a stream? And isn't it easy to do so already? The name is
> >>>> bad, too. I vote to reject.
> >>>
> >>> I'm sure one doesn't need to write multiple copies of a character
> >>> to a stream too often, but why reject this manipulator on the
> >>> grounds that it isn't needed very often?
> >>
> >> Because it clutters up the library, making it harder for people to find the
> >> parts they really need.
> >>
> >> Also, the straightforward way of writing a sequence of repeated characters to
> >> a stream makes it immediately obvious what is being done, whereas
> >> programmers looking at code written by someone else can't be expected to know
> >> what multi_newer does. If a component fills an important need, it's
> >> reasonable to expect people to learn about it if they want to understand your
> >> code -- otherwise, I don't see the point.
> >
> > Daryle can build his own defense on why he included multi_newer.
> > It is cleaner than inserting the same character multiple times.
> > You're right that it's not an improvement over inserting
> > std::string('c', n). The name, of course, is a problem, too.
> The idea for "multi_newer" just popped into my head. The string solution is
> worse because it forces an extra memory allocation.

I bring you back to the question at the top: how often does one
need to do this? I contend it isn't often and the memory
allocation for building the string is most likely swamped by the
other overhead in writing it and whatever accompanies it on the
output device.

Rob Stewart                           stewart_at_[hidden]
Software Engineer           
Susquehanna International Group, LLP  using std::disclaimer;

Boost list run by bdawes at, gregod at, cpdaniel at, john at