[SERVER-32422] convert StringData to std::string_view Created: 20/Dec/17 Updated: 02/Nov/23 |
|
| Status: | Backlog |
| Project: | Core Server |
| Component/s: | Portability |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Improvement | Priority: | Minor - P4 |
| Reporter: | Billy Donahue | Assignee: | Backlog - Service Architecture |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | sa-remove-fv-backlog-22, techdebt | ||
| Σ Remaining Estimate: | Not Specified | Remaining Estimate: | Not Specified |
| Σ Time Spent: | Not Specified | Time Spent: | Not Specified |
| Σ Original Estimate: | Not Specified | Original Estimate: | Not Specified |
| Issue Links: |
|
||||||||||||||||||||
| Sub-Tasks: |
|
||||||||||||||||||||
| Assigned Teams: |
Service Arch
|
||||||||||||||||||||
| Participants: | |||||||||||||||||||||
| Description |
|
I want to collect some notes on differences in StringData that could complicate a migration to std::string_view. The BIG one: as of its introduction in C++17, std::string_view(cp) is UB for null-valued cp, but this is tolerated for StringData. This will be very difficult to audit for, as this is an implicit constructor. Renames:
Several public members must be brought outside the class:
Behavior:
Needs more members:
Apparatus:
|
| Comments |
| Comment by Billy Donahue [ 02/Nov/23 ] | |||
|
Our macOS builds are using XCode 13.2.1 (13 Dec 2021) which doesn't have a great std::string_view.
| |||
| Comment by Billy Donahue [ 01/Nov/23 ] | |||
|
Another complication. On Windows, the std::string_view::iterator type is a class, and it is NOT const char*. Unsurprisingly we have some code that breaks from this.
The simplest fix is to replace But this is giving up on some of the pretty intense debug-mode instrumentation provided by this iterator class. Of course, we're not getting any of that instrumentation with StringData today but it would be nice to get it as a side effect of the std::string_view migration. |