
"Andrei Alexandrescu \(See Website for Email\)" <andrewalex@hotmail.com> writes:
"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.
Well, it might. But then, the user knows he's using the initialization library, and operator, has a different meaning in that context, just like operator<< means something else in the context of a Spirit gramar. -- Dave Abrahams Boost Consulting http://www.boost-consulting.com