From 04c17c7a767417edc113ae8e252d1649b05250c9 Mon Sep 17 00:00:00 2001 From: Austin Schuh Date: Thu, 26 Dec 2019 10:02:24 -0800 Subject: [PATCH] Add support for absl::string_view when available (#5682) For C++11 platforms, absl::string_view is sometimes available. This can be used for string_view when std::string_view is not available. --- include/flatbuffers/base.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/include/flatbuffers/base.h b/include/flatbuffers/base.h index 48f91d600..562e5e03f 100644 --- a/include/flatbuffers/base.h +++ b/include/flatbuffers/base.h @@ -212,6 +212,13 @@ namespace flatbuffers { typedef std::experimental::string_view string_view; } #define FLATBUFFERS_HAS_STRING_VIEW 1 + // Check for absl::string_view + #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