Skip to content

Commit

Permalink
Introduce convenient implicit operator string_view
Browse files Browse the repository at this point in the history
  • Loading branch information
georgthegreat authored Dec 1, 2023
1 parent 5ba80c2 commit a8b7054
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 a8b7054

Please sign in to comment.