diff options
author | Vladimir Glavnyy <31897320+vglavnyy@users.noreply.github.com> | 2020-12-08 02:12:58 +0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-07 11:12:58 -0800 |
commit | 8d9eae9ac95c06ca1ae0139a8d80522163a17ae5 (patch) | |
tree | 850b481c2e7a48b44f6e13b125a3e7f8f7d383ed /include | |
parent | 2046bffa40400904c926c2a5bedab67a8d6b7e08 (diff) | |
download | flatbuffers-8d9eae9ac95c06ca1ae0139a8d80522163a17ae5.tar.gz flatbuffers-8d9eae9ac95c06ca1ae0139a8d80522163a17ae5.tar.bz2 flatbuffers-8d9eae9ac95c06ca1ae0139a8d80522163a17ae5.zip |
[idl_parser] Unify parsing of NaN values read from .fbs and .json files (#6296)
This commit unifies parsing of NaN values read
from .fbs and .json files by converting them to unsigned NaN.
Diffstat (limited to 'include')
-rw-r--r-- | include/flatbuffers/base.h | 7 | ||||
-rw-r--r-- | include/flatbuffers/stl_emulation.h | 6 |
2 files changed, 12 insertions, 1 deletions
diff --git a/include/flatbuffers/base.h b/include/flatbuffers/base.h index 95b788e0..92db55b7 100644 --- a/include/flatbuffers/base.h +++ b/include/flatbuffers/base.h @@ -197,12 +197,17 @@ namespace flatbuffers { #if (!defined(_MSC_VER) || _MSC_FULL_VER >= 180020827) && \ (!defined(__GNUC__) || (__GNUC__ * 100 + __GNUC_MINOR__ >= 404)) || \ defined(__clang__) - #define FLATBUFFERS_DEFAULT_DECLARATION #define FLATBUFFERS_DELETE_FUNC(func) func = delete; #else #define FLATBUFFERS_DELETE_FUNC(func) private: func; #endif +#if (!defined(_MSC_VER) || _MSC_VER >= 1900) && \ + (!defined(__GNUC__) || (__GNUC__ * 100 + __GNUC_MINOR__ >= 409)) || \ + defined(__clang__) + #define FLATBUFFERS_DEFAULT_DECLARATION +#endif + // Check if we can use template aliases // Not possible if Microsoft Compiler before 2012 // Possible is the language feature __cpp_alias_templates is defined well diff --git a/include/flatbuffers/stl_emulation.h b/include/flatbuffers/stl_emulation.h index 66bd620d..70e5dc94 100644 --- a/include/flatbuffers/stl_emulation.h +++ b/include/flatbuffers/stl_emulation.h @@ -164,6 +164,8 @@ inline void vector_emplace_back(std::vector<T> *vector, V &&data) { using conditional = std::conditional<B, T, F>; template<class T, T v> using integral_constant = std::integral_constant<T, v>; + template <bool B> + using bool_constant = integral_constant<bool, B>; #else // Map C++ TR1 templates defined by stlport. template <typename T> using is_scalar = std::tr1::is_scalar<T>; @@ -187,6 +189,8 @@ inline void vector_emplace_back(std::vector<T> *vector, V &&data) { using conditional = std::tr1::conditional<B, T, F>; template<class T, T v> using integral_constant = std::tr1::integral_constant<T, v>; + template <bool B> + using bool_constant = integral_constant<bool, B>; #endif // !FLATBUFFERS_CPP98_STL #else // MSVC 2010 doesn't support C++11 aliases. @@ -201,6 +205,8 @@ inline void vector_emplace_back(std::vector<T> *vector, V &&data) { struct conditional : public std::conditional<B, T, F> {}; template<class T, T v> struct integral_constant : public std::integral_constant<T, v> {}; + template <bool B> + struct bool_constant : public integral_constant<bool, B> {}; #endif // defined(FLATBUFFERS_TEMPLATES_ALIASES) #ifndef FLATBUFFERS_CPP98_STL |