[C++-sig] dict surprise
david.abrahams at rcn.com
Sat Jul 20 13:39:20 CEST 2002
From: "Ralf W. Grosse-Kunstleve" <rwgk at yahoo.com>
> I was surprised to find that
> only updates the temporary created by dict(), but not the original
> Eventually I got the desired behavior by using
> I convinced myself that the first statement works just the way Python
> fine. However, this is a bit of a trap for the novice and a specific
> the documentation ("don't use dict(obj1).update(obj2)") would probably be
We'd have to warn about list, too, and probably a whole host of others. Is
it worth it?
This seems like a corner case to me.
> P.S.: I love the new extract<T> .
I hope you're using it with T = U& to avoid copies when appropriate...
More information about the Cplusplus-sig