Skip to content

Commit 37bfd3a

Browse files
committed
From flatbuffers upstream: Fix include of string_view with C++17 abseil
Original author of change: ocpalo Backport/update from upstream flatbuffers repository. Changes taken from google/flatbuffers#7897.
1 parent e536216 commit 37bfd3a

File tree

1 file changed

+11
-6
lines changed
  • include/behaviortree_cpp_v3/flatbuffers

1 file changed

+11
-6
lines changed

include/behaviortree_cpp_v3/flatbuffers/base.h

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -237,12 +237,17 @@ namespace flatbuffers {
237237
}
238238
#define FLATBUFFERS_HAS_STRING_VIEW 1
239239
// Check for absl::string_view
240-
#elif __has_include("absl/strings/string_view.h")
241-
#include "absl/strings/string_view.h"
242-
namespace flatbuffers {
243-
typedef absl::string_view string_view;
244-
}
245-
#define FLATBUFFERS_HAS_STRING_VIEW 1
240+
#elif __has_include("absl/strings/string_view.h") && \
241+
__has_include("absl/base/config.h") && \
242+
(__cplusplus >= 201411)
243+
#include "absl/base/config.h"
244+
#if !defined(ABSL_USES_STD_STRING_VIEW)
245+
#include "absl/strings/string_view.h"
246+
namespace flatbuffers {
247+
typedef absl::string_view string_view;
248+
}
249+
#define FLATBUFFERS_HAS_STRING_VIEW 1
250+
#endif
246251
#endif
247252
#endif // __has_include
248253
#endif // !FLATBUFFERS_HAS_STRING_VIEW

0 commit comments

Comments
 (0)