Use string_view if _HAS_CXX17 is true (#4876)
authoriceboy <me@iceboy.org>
Mon, 13 Aug 2018 23:19:51 +0000 (16:19 -0700)
committerWouter van Oortmerssen <aardappel@gmail.com>
Mon, 13 Aug 2018 23:19:51 +0000 (16:19 -0700)
Current version of VC2017 is not setting __cplusplus to correct value, instead they use _MSC_VER, _MSVC_LANG and _HAS_CXX17 macros.

include/flatbuffers/base.h

index e09e828..61ca651 100644 (file)
   // to detect a header that provides an implementation
   #if defined(__has_include)
     // Check for std::string_view (in c++17)
-    #if __has_include(<string_view>) && (__cplusplus >= 201606)
+    #if __has_include(<string_view>) && (__cplusplus >= 201606 || _HAS_CXX17)
       #include <string_view>
       namespace flatbuffers {
         typedef std::string_view string_view;