diff options
author | Mathias Stearn <mathias@10gen.com> | 2015-04-24 19:00:39 -0400 |
---|---|---|
committer | Mathias Stearn <mathias@10gen.com> | 2015-05-04 19:30:07 -0400 |
commit | a7cc663e53d907f3c5998748770793ade95bdaa1 (patch) | |
tree | f5878842d9a615390cdcdb97d7f2d0da94dfb48c /src/mongo/db/pipeline/value.h | |
parent | 50922d9f626758855326f6b5a06e940269189e11 (diff) | |
download | mongo-a7cc663e53d907f3c5998748770793ade95bdaa1.tar.gz |
SERVER-18204 Remove Value::consume()
It was a temporary stopgap until we were on C++11 and could std::move vectors.
We now live in that world.
Diffstat (limited to 'src/mongo/db/pipeline/value.h')
-rw-r--r-- | src/mongo/db/pipeline/value.h | 16 |
1 files changed, 3 insertions, 13 deletions
diff --git a/src/mongo/db/pipeline/value.h b/src/mongo/db/pipeline/value.h index 4e30c30564d..c79a02ec972 100644 --- a/src/mongo/db/pipeline/value.h +++ b/src/mongo/db/pipeline/value.h @@ -74,13 +74,13 @@ namespace mongo { explicit Value(double value) : _storage(NumberDouble, value) {} explicit Value(const Timestamp& value) : _storage(bsonTimestamp, value) {} explicit Value(const OID& value) : _storage(jstOID, value) {} - explicit Value(StringData value) : _storage(String, value) {} - explicit Value(const std::string& value) : _storage(String, StringData(value)) {} + explicit Value(StringData value) : _storage(String, value) {} + explicit Value(const std::string& value) : _storage(String, StringData(value)) {} explicit Value(const char* value) : _storage(String, StringData(value)) {} explicit Value(const Document& doc) : _storage(Object, doc) {} explicit Value(const BSONObj& obj); explicit Value(const BSONArray& arr); - explicit Value(const std::vector<Value>& vec) : _storage(Array, new RCVector(vec)) {} + explicit Value(std::vector<Value> vec) : _storage(Array, new RCVector(std::move(vec))) {} explicit Value(const BSONBinData& bd) : _storage(BinData, bd) {} explicit Value(const BSONRegEx& re) : _storage(RegEx, re) {} explicit Value(const BSONCodeWScope& cws) : _storage(CodeWScope, cws) {} @@ -107,16 +107,6 @@ namespace mongo { */ static Value createIntOrLong(long long value); - /** Construct an Array-typed Value from consumed without copying the vector. - * consumed is replaced with an empty vector. - * In C++11 this would be spelled Value(std::move(consumed)). - */ - static Value consume(std::vector<Value>& consumed) { - RCVector* vec = new RCVector(); - std::swap(vec->vec, consumed); - return Value(ValueStorage(Array, vec)); - } - /** A "missing" value indicates the lack of a Value. * This is similar to undefined/null but should not appear in output to BSON. * Missing Values are returned by Document when accessing non-existent fields. |