[SERVER-2224] BSONObjBuilder::append( const StringData& fieldName, string str), second argument should be passed by const& Created: 14/Dec/10  Updated: 12/Jul/16  Resolved: 15/Dec/10

Status: Closed
Project: Core Server
Component/s: Internal Client
Affects Version/s: None
Fix Version/s: 1.7.4

Type: Improvement Priority: Minor - P4
Reporter: Andrew Morrow (Inactive) Assignee: Eliot Horowitz (Inactive)
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Participants:

 Description   

The overload of BSONObjBuilder::append that takes a std::string as its second argument takes the string by value, forcing a needless copy.

https://github.com/mongodb/mongo/blob/master/bson/bsonobjbuilder.h#L379

The string should be passed by const&.



 Comments   
Comment by auto [ 15/Dec/10 ]

Author:

{u'login': u'erh', u'name': u'Eliot Horowitz', u'email': u'eliot@10gen.com'}

Message: BONObjBuilder::append( const StringData& fieldName, string str), second argument should be passed by const& SERVER-2224
https://github.com/mongodb/mongo/commit/2da179f9a718ec904b4988ce91036f0ea5701494

Generated at Thu Feb 08 02:59:20 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.