[SERVER-43583] StringData should get most or all string_view member functions Created: 23/Sep/19  Updated: 06/Dec/22

Status: Backlog
Project: Core Server
Component/s: Internal Code
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Billy Donahue Assignee: Backlog - Service Architecture
Resolution: Unresolved Votes: 0
Labels: sa-remove-fv-backlog-22
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
related to SERVER-55180 Remove StringData <=> std::string_vie... Closed
is related to SERVER-55381 StringData find and rfind incorrect r... Closed
Assigned Teams:
Service Arch
Operating System: ALL
Participants:
Story Points: 4

 Description   

I've seen code switch to std::string_view because it has better find and slicing members than StringData. That shouldn't be necessary. We can add all those functions to StringData. I'm talking about members like: at, remove_prefix, remove_suffix, find_first_of, find_last_not_of, etc. and all the overloads of each to support pos and count, and throwing the same std:: exceptions.



 Comments   
Comment by Billy Donahue [ 23/Mar/21 ]

Best plan would be to forward everything to the equivalent std::string_view member function.

Perhaps just keep a std::string_view as the sole data member.
Then we don't have to deal with bugs like SERVER-55381 that produce unnecessary incompatibility.

The std::string_view code is going to be keenly optimized and tested.
Our implementations are definitely not (per SERVER-55381).

Comment by Benjamin Caimano (Inactive) [ 30/Jun/20 ]

I'd want that to be a follow on ticket that goes through our triage process.

Comment by Billy Donahue [ 30/Jun/20 ]

We did however discuss that code that is working around the current lack of these functions in StringData (e.g. by conversion to string_view and back) could be improved as part of this ticket.

Comment by Benjamin Caimano (Inactive) [ 30/Jun/20 ]

Making a note here that this should not mean we remove any existing functions. This should be a change to the StringData files only.

Generated at Thu Feb 08 05:03:32 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.