Skip to content

Commit

Permalink
Introduce convenient implicit operator string_view (google#8181)
Browse files Browse the repository at this point in the history
Co-authored-by: Derek Bailey <[email protected]>
  • Loading branch information
2 people authored and Jochen Parmentier committed Oct 29, 2024
1 parent fb94790 commit e4bdb5c
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions include/flatbuffers/string.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ struct String : public Vector<char> {
flatbuffers::string_view string_view() const {
return flatbuffers::string_view(c_str(), size());
}

/* implicit */
operator flatbuffers::string_view() const {
return flatbuffers::string_view(c_str(), size());
}
#endif // FLATBUFFERS_HAS_STRING_VIEW
// clang-format on

Expand Down

0 comments on commit e4bdb5c

Please sign in to comment.