convert StringData to std::string_view
(SERVER-32422)
|
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | 7.3.0-rc0 |
| Type: | Sub-task | Priority: | Major - P3 |
| Reporter: | Billy Donahue | Assignee: | Billy Donahue |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||
| Backwards Compatibility: | Fully Compatible | ||||||||
| Participants: | |||||||||
| Comments |
| Comment by Billy Donahue [ 15/Nov/23 ] |
|
[Announcement to #server copied here for durability...] Howdy Serverinos! Quick announcement about the ubiquitous mongo::StringData class.
We've taken the step of giving it a single std::string_view data member and forwarding all member functions to that data member. You might think of it as simulating private inheritance. Mostly everything string_view could do (at least the large subset supported by all platforms) can now be done with StringData. That includes:
Caveats: All uses of StringData in the codebase have been adapted to deal with the API change. But hopefully this announcement will reduce surprise. [1] This is unfortunate, but it's a C++20 feature and the string_view in XCode13.2.1 doesn't have it, and we don't want complete conversion to std::string_view to be blocked on an XCode upgrade. It wasn't hard to work around this in practice. This is also why it doesn't have a contains member. |
| Comment by Githook User [ 14/Nov/23 ] |
|
Author: {'name': 'Billy Donahue', 'email': 'billy.donahue@mongodb.com', 'username': 'BillyDonahue'}Message: |