Introduce convenient implicit operator string_view (#8181)

Co-authored-by: Derek Bailey <derekbailey@google.com>
This commit is contained in:
Yuriy Chernyshov
2023-12-17 07:30:21 +01:00
committed by GitHub
parent 0e1305c8e2
commit dd79eed495

View File

@@ -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