Boost logo

Boost :

From: Dave Harris (brangdon_at_[hidden])
Date: 2004-07-07 14:45:05


In-Reply-To: <cch4as$941$1_at_[hidden]>
andrewalex_at_[hidden] (Andrei Alexandrescu \(See Website for Email\))
wrote (abridged):
> I was worried more (only) about the order of evaluation.
>
> v += foo(), bar();

I don't think order of evaluation is sacred. However, I am also not keen
on using comma for this. I'd rather use operator<<().

    v << foo() << bar();

This is partly because comma is so small its easy to overlook, partly
because it is used for so many other common things, and partly because I
think the semantics of operator<<() fit better here. "Append these items
to that stream or container, with conversion or formatting if
appropriate."

I would also be happy with:
    v << repeat(5) << 4;

meaning:
    v << 4 << 4 << 4 << 4 << 4;

and so forth. It doesn't bother me that:
    v = 1, 2, 3;

has no direct equivalent. It becomes:
    v.clear();
    v << 1 << 2 << 3;

Presumably you'd be content with operator<<() in that it doesn't imply an
order of evaluation.

-- Dave Harris, Nottingham, UK


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