Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
F
flatbuffers
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
flatbuffers
Commits
e1f48ad3
Commit
e1f48ad3
authored
Aug 23, 2018
by
Derek Bailey
Committed by
Wouter van Oortmerssen
Aug 23, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updated preprocessor check for template aliases. (#4888)
parent
d8f49e18
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
6 deletions
+16
-6
stl_emulation.h
include/flatbuffers/stl_emulation.h
+16
-6
No files found.
include/flatbuffers/stl_emulation.h
View file @
e1f48ad3
...
@@ -33,6 +33,16 @@
...
@@ -33,6 +33,16 @@
#include <cctype>
#include <cctype>
#endif // defined(FLATBUFFERS_CPP98_STL)
#endif // defined(FLATBUFFERS_CPP98_STL)
// 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
// Or possible if the C++ std is C+11 or newer
#if !(defined(_MSC_VER) && _MSC_VER <= 1700
/* MSVC2012 */
) \
&& ((defined(__cpp_alias_templates) && __cpp_alias_templates >= 200704) \
|| (defined(__cplusplus) && __cplusplus >= 201103L))
#define FLATBUFFERS_TEMPLATES_ALIASES
#endif
// This header provides backwards compatibility for C++98 STLs like stlport.
// This header provides backwards compatibility for C++98 STLs like stlport.
namespace
flatbuffers
{
namespace
flatbuffers
{
...
@@ -69,13 +79,13 @@ inline void vector_emplace_back(std::vector<T> *vector, V &&data) {
...
@@ -69,13 +79,13 @@ inline void vector_emplace_back(std::vector<T> *vector, V &&data) {
}
}
#ifndef FLATBUFFERS_CPP98_STL
#ifndef FLATBUFFERS_CPP98_STL
#if
!(defined(_MSC_VER) && _MSC_VER <= 1700
/* MSVC2012 */
)
#if
defined(FLATBUFFERS_TEMPLATES_ALIASES
)
template
<
typename
T
>
template
<
typename
T
>
using
numeric_limits
=
std
::
numeric_limits
<
T
>
;
using
numeric_limits
=
std
::
numeric_limits
<
T
>
;
#else
#else
template
<
typename
T
>
class
numeric_limits
:
template
<
typename
T
>
class
numeric_limits
:
public
std
::
numeric_limits
<
T
>
{};
public
std
::
numeric_limits
<
T
>
{};
#endif //
!(defined(_MSC_VER) && _MSC_VER <= 1700
/* MSVC2012 */
)
#endif //
defined(FLATBUFFERS_TEMPLATES_ALIASES
)
#else
#else
template
<
typename
T
>
class
numeric_limits
:
template
<
typename
T
>
class
numeric_limits
:
public
std
::
numeric_limits
<
T
>
{};
public
std
::
numeric_limits
<
T
>
{};
...
@@ -98,7 +108,7 @@ inline void vector_emplace_back(std::vector<T> *vector, V &&data) {
...
@@ -98,7 +108,7 @@ inline void vector_emplace_back(std::vector<T> *vector, V &&data) {
};
};
#endif // FLATBUFFERS_CPP98_STL
#endif // FLATBUFFERS_CPP98_STL
#if
!(defined(_MSC_VER) && _MSC_VER <= 1700
/* MSVC2012 */
)
#if
defined(FLATBUFFERS_TEMPLATES_ALIASES
)
#ifndef FLATBUFFERS_CPP98_STL
#ifndef FLATBUFFERS_CPP98_STL
template
<
typename
T
>
using
is_scalar
=
std
::
is_scalar
<
T
>
;
template
<
typename
T
>
using
is_scalar
=
std
::
is_scalar
<
T
>
;
template
<
typename
T
,
typename
U
>
using
is_same
=
std
::
is_same
<
T
,
U
>
;
template
<
typename
T
,
typename
U
>
using
is_same
=
std
::
is_same
<
T
,
U
>
;
...
@@ -119,10 +129,10 @@ inline void vector_emplace_back(std::vector<T> *vector, V &&data) {
...
@@ -119,10 +129,10 @@ inline void vector_emplace_back(std::vector<T> *vector, V &&data) {
template
<
typename
T
>
struct
is_floating_point
:
template
<
typename
T
>
struct
is_floating_point
:
public
std
::
is_floating_point
<
T
>
{};
public
std
::
is_floating_point
<
T
>
{};
template
<
typename
T
>
struct
is_unsigned
:
public
std
::
is_unsigned
<
T
>
{};
template
<
typename
T
>
struct
is_unsigned
:
public
std
::
is_unsigned
<
T
>
{};
#endif //
!(defined(_MSC_VER) && _MSC_VER <= 1700
/* MSVC2012 */
)
#endif //
defined(FLATBUFFERS_TEMPLATES_ALIASES
)
#ifndef FLATBUFFERS_CPP98_STL
#ifndef FLATBUFFERS_CPP98_STL
#if
!(defined(_MSC_VER) && _MSC_VER <= 1700
/* MSVC2012 */
)
#if
defined(FLATBUFFERS_TEMPLATES_ALIASES
)
template
<
class
T
>
using
unique_ptr
=
std
::
unique_ptr
<
T
>
;
template
<
class
T
>
using
unique_ptr
=
std
::
unique_ptr
<
T
>
;
#else
#else
// MSVC 2010 doesn't support C++11 aliases.
// MSVC 2010 doesn't support C++11 aliases.
...
@@ -148,7 +158,7 @@ inline void vector_emplace_back(std::vector<T> *vector, V &&data) {
...
@@ -148,7 +158,7 @@ inline void vector_emplace_back(std::vector<T> *vector, V &&data) {
return
std
::
unique_ptr
<
T
>::
operator
=
(
p
);
return
std
::
unique_ptr
<
T
>::
operator
=
(
p
);
}
}
};
};
#endif //
!(defined(_MSC_VER) && _MSC_VER <= 1700
/* MSVC2012 */
)
#endif //
defined(FLATBUFFERS_TEMPLATES_ALIASES
)
#else
#else
// Very limited implementation of unique_ptr.
// Very limited implementation of unique_ptr.
// This is provided simply to allow the C++ code generated from the default
// This is provided simply to allow the C++ code generated from the default
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment