Boost logo

Boost :

From: George A. Heintzelman (georgeh_at_[hidden])
Date: 2001-07-02 09:54:10

First, I want to express another boost-lurker's feeling that the %
notation isn't very appealing to me. But, I'm willing to work with it
if it is necessary to get a format object that meets the other
compelling needs.

> Also, the possibilty to store format objects, like :
> format formatter("%1 %2 %3 \n");
> cerr << formatter.print() %1 %2 %3;
> cerr << formatter.print() %-1 %-2 %-3;
> assert( (formatter.print() %-1 %-2 %-3).str() == "-1 -2 -3 \n");

I like this functionality; I suspect it could be very useful for
complex formats. However, I think the logic expressed by the 'print()'
call is not printing at all, but 'clear'-ing the formatting object,
which has gotten bound to certain sets of arguments.

One could argue that clear() should be invoked by the operator<< call
instead, after printing of course, which leads to IMHO more natural
syntax. There might be other problems that I haven't thought of here,
but I would consider this.

A second issue -- if this functionality is going to be supplied, one
ought to be able to set stickily formatting options on an argument. E.g:

format formatter("%1 %2 %3 \n");

Or some such syntax; and then have the second argument always set to 8

George Heintzelman

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