Boost logo

Boost :

From: James Kanze (kanze_at_[hidden])
Date: 2002-02-20 15:52:14


Karl Nelson <kenelson_at_[hidden]> writes:

|> [snip]
|> > > I think most programmers would expect it to give them the nth
|> > > character of the formatted string. But I'm just guessing about
|> > > this.

|> > Interesting. I never looked at it this way. I would suspect that
|> > there would be very few cases where someone would get confused
|> > about the meaning in this way. However, if I'm wrong, it would be
|> > a good argument against operator[].

|> I would have expected that [] on a format gives access to a
|> formatting specifications for argument #.

|> Ie.

|> format_expr fmt("%d %s");

|> fmt[0] gives "%d"

|> (Okay it is a bit confusing as printf starts from one.)

|> I personally view operator [] as "indexing". So foo[i][j] means
|> "j-th of i-th of foo".

I suspect that that is what most programmers think of it as. I'll admit
that I only thought of it as projection after reading Barton and
Nackman. And that I tend to have a deep understanding of the lower
layer aspects, which may cloud my vision.

|> I think the use of .with() or operator() has more merit.
|> But this is purely personal preference.

Fundamentally, I think that any choice of operator will involve personal
preference. About the only real technical requirement is that it have a
strictly lower precedence than the four basic operators -- after that, I
could live with any of them, even if my personal preference is for
.with().

-- 
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