
7 Jul
2004
7 Jul
'04
3:19 p.m.
"Vladimir Prus" <ghost@cs.msu.su> wrote in message news:ccg4pu$pns$1@sea.gmane.org...
I think in this context it's more or less harmless. One can do:
vector<int> v; v += 1, 2, 3;
but the += operator is only defined for specific containers, and it's not defined for vector by default. So there's little risk that user will inadvertently use it, meaning something else.
I was worried more (only) about the order of evaluation. If I understand correctly, if I call: v += foo(), bar(); the code will be same as: operator,(operator+=(v, foo()), bar()); so the order of executing foo() and bar() is unspecified. This might surprise the user. Andrei