Boost logo

Boost :

From: James Kanze (kanze_at_[hidden])
Date: 2002-01-27 11:43:58


Beman Dawes <bdawes_at_[hidden]> writes:

|> At 07:49 AM 1/20/2002, Samuel Krempp wrote:

|> >Now that I think there is a better candidate than '%', I'll add
|> >some arguments for 'operator[]' in the doc. but it's rather a
|> >matter of taste, so I'm not sure I will be able to convince people
|> >with only a few lines..

|> I'm sorry. I just find:

|> cout << format("writing %3, x=%1 : %2-th try") % 40.23 % 50 % "toto";

|> to be a lot easier to write and read than:

|> cout << format("writing %3, x=%1 : %2-th try") [40.23] [50] ["toto"];

|> I have the sense that Ed's operator[] suggestion would solve some
|> technical problems, but it just plain looks too ugly to me.

|> What do others think?

Coming in late, but...

First, of course, '%' is out of the question, since it has the wrong
priority.

In the end, my preference is for the member function with, since it is
the only solution which really guarantees correct grouping, and is also
by far the most readable. If an operator is wanted, what's wrong with
<<; it is currently the formatting operator, so why change it.

And finally, why not just make the strings compatible with the X/Open
extensioned printf, which everyone pretty much knows already, and be
done with it. There are a few problems, but nothing overwhelming.

-- 
James Kanze                                mailto:kanze_at_[hidden]
Conseils en informatique orientée objet/
                    Beratung in objektorientierter Datenverarbeitung
Ziegelhüttenweg 17a, 60598 Frankfurt, Germany Tel. +49(0)179 2607481

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