Recycle heap on assignment
authorNicholas Ormrod <njormrod@fb.com>
Fri, 12 Jun 2015 16:13:33 +0000 (09:13 -0700)
committerSara Golemon <sgolemon@fb.com>
Fri, 12 Jun 2015 20:18:15 +0000 (13:18 -0700)
commit461f01823caf2c1d17a1cecee98603c7c58c7710
tree9ee99be5c0d32be4bced5835fd8d48c325dc58fc
parent9f41a73a76efc8f46eb0ac523b2c891acdb8b07b
Recycle heap on assignment

Summary: For standard containers, assignment tries to reuse heap space.
Dynamic assignment does not - it calls destroy(), and then reconstructs
a new dynamic. In the case that the old and new types are the same (eg
assigning a dynamic-vector to a dynamic-vector) we can call through to
the underlying type's assignment operator.

Reviewed By: @jdelong

Differential Revision: D2148093
folly/dynamic.cpp
folly/test/DynamicTest.cpp