0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-12-01 09:32:32 +01:00

fast done capability for BSONObjBuilder

This commit is contained in:
Andrew C. Morrow 2010-07-27 00:10:02 +08:00 committed by Eliot
parent ce531f1481
commit 8443231430

View File

@ -508,6 +508,11 @@ namespace mongo {
return BSONObj(_done());
}
// Like 'done' above, but does not construct a BSONObj to return to the caller.
void doneFast() {
(void)_done();
}
/** Peek at what is in the builder, but leave the builder ready for more appends.
The returned object is only valid until the next modification or destruction of the builder.
Intended use case: append a field if not already there.
@ -639,6 +644,8 @@ namespace mongo {
BSONObj done() { return _b.done(); }
void doneFast() { _b.doneFast(); }
template <typename T>
BSONArrayBuilder& append(const StringData& name, const T& x){
fill( name );