Details
Description
Document/Value dates from before C++11, so some places where it is using const& would benefit from either a && or by-value overload. Their lack is not intentional, more that it wasn't possible to move at the time they were written. The basic move support was added in SERVER-18520, but more work is needed to take full advantage of it.
A few notable omissions (very much non-exhaustive):
- Value::Value(const Document&) and everything it recursively calls. The high call depth probably means it makes sense to use a && overload, since the by-value cost increases with depth even when moving.
- MutableDocument::addField(StringData, const Value&)