[CXX-2266] Use bsoncxx::string::view_or_value in gridfs::bucket Created: 19/May/21  Updated: 16/Oct/23

Status: Backlog
Project: C++ Driver
Component/s: None
Affects Version/s: None
Fix Version/s: 4.0.0

Type: Improvement Priority: Minor - P4
Reporter: Adrian B Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
related to CXX-2270 Audit string arguments Backlog
Epic Link: CXX-2761

 Description   

mongocxx::bucket::bucket_name() takes a std::string.
As other parts of the code, a bsoncxx::string::view_or_value should be used.



 Comments   
Comment by Adrian B [ 20/May/21 ]

Hi Kevin,
Yes, mainly a consistency issue and also to avoid the user to allocate a string when he has a string_view or a const char* (as a static global variable by example).
We should survive without it .
Thanks.

Comment by Kevin Albertson [ 20/May/21 ]

Hi adrian.blandin@sovo-tech.com! Thank you for the report. Since mongocxx::bucket::bucket_name retains a copy of the passed string, I don't think this is strictly necessary. Unnecessary copies could be avoided by a std::move of the passed string. But it seems like a worthwhile improvement to make for consistency in the next major release.

Generated at Wed Feb 07 22:05:22 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.