Skip to content

Commit

Permalink
Use std::string_view instead of base::StringPiece
Browse files Browse the repository at this point in the history
Based on crrev.com/c/4294483, it sounds like the current guideline is to
use `std::string_view`.

Bug: None
Change-Id: I5e5f6baa6ca45ab0ef79f6021a8fde0434b5f333
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4724955
Reviewed-by: danakj <danakj@chromium.org>
Reviewed-by: David Benjamin <davidben@chromium.org>
Commit-Queue: Hong Xu <xuhong@google.com>
Cr-Commit-Position: refs/heads/main@{#1176298}
  • Loading branch information
xuhdev authored and Chromium LUCI CQ committed Jul 27, 2023
1 parent 5084692 commit 5e492d3
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions styleguide/c++/c++-features.md
Original file line number Diff line number Diff line change
Expand Up @@ -1719,10 +1719,7 @@ absl::string_view
*** promo
Originally banned due to only working with 8-bit characters. Now it is
unnecessary because, in Chromium, it is the same type as `std::string_view`.
Use `base::StringPiece` from `base/strings/`, unless interfacing with
third-party code, in which case prefer to write the type as `std::string_view`.
Note `base::StringPiece` implicitly converts to and from `std::string_view`, so
one typically does not need to write the STL name.
Please use `std::string_view` instead.
***

### Strings Library <sup>[banned]</sup>
Expand Down

0 comments on commit 5e492d3

Please sign in to comment.