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.
This commit is contained in:
Austin Schuh 2019-12-26 10:02:24 -08:00 committed by Wouter van Oortmerssen
parent 62ec7d52ce
commit 04c17c7a76
1 changed files with 7 additions and 0 deletions

View File

@ -212,6 +212,13 @@ namespace flatbuffers {
typedef std::experimental::string_view string_view; typedef std::experimental::string_view string_view;
} }
#define FLATBUFFERS_HAS_STRING_VIEW 1 #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
#endif // __has_include #endif // __has_include
#endif // !FLATBUFFERS_HAS_STRING_VIEW #endif // !FLATBUFFERS_HAS_STRING_VIEW