Add support for absl::string_view to flatbuffers
This lets us use string_views to manipulate flatbuffers::String objects
much easier.
Change-Id: Ie51864822af0cd8209d643767d6f73a8d7e025f8
diff --git a/third_party/flatbuffers/include/flatbuffers/base.h b/third_party/flatbuffers/include/flatbuffers/base.h
index d98da13..4eff0a6 100644
--- a/third_party/flatbuffers/include/flatbuffers/base.h
+++ b/third_party/flatbuffers/include/flatbuffers/base.h
@@ -212,6 +212,13 @@
typedef std::experimental::string_view string_view;
}
#define FLATBUFFERS_HAS_STRING_VIEW 1
+ // Check for absl::string_view (in c++14, compiler-dependent)
+ #elif __has_include("absl/strings/string_view.h")
+ #include "absl/strings/string_view.h"
+ namespace flatbuffers {
+ typedef absl::string_view string_view;
+ }
+ #define FLATBUFFERS_HAS_STRING_VIEW 1
#endif
#endif // __has_include
#endif // !FLATBUFFERS_HAS_STRING_VIEW