mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-30 07:20:03 +00:00
Introduce convenient implicit operator string_view (#8181)
Co-authored-by: Derek Bailey <derekbailey@google.com>
This commit is contained in:
@@ -31,6 +31,11 @@ struct String : public Vector<char> {
|
|||||||
flatbuffers::string_view string_view() const {
|
flatbuffers::string_view string_view() const {
|
||||||
return flatbuffers::string_view(c_str(), size());
|
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
|
#endif // FLATBUFFERS_HAS_STRING_VIEW
|
||||||
// clang-format on
|
// clang-format on
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user