Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
json
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
json
Commits
af8c6e7a
Unverified
Commit
af8c6e7a
authored
4 years ago
by
Niels Lohmann
Committed by
GitHub
4 years ago
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2533 from nlohmann/c++_future
Do not unconditionally redefine C++14 constructs
parents
5c1a5bc9
467986fe
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
8 deletions
+41
-8
include/nlohmann/detail/meta/cpp_future.hpp
include/nlohmann/detail/meta/cpp_future.hpp
+20
-4
single_include/nlohmann/json.hpp
single_include/nlohmann/json.hpp
+21
-4
No files found.
include/nlohmann/detail/meta/cpp_future.hpp
View file @
af8c6e7a
...
...
@@ -2,19 +2,32 @@
#include <cstddef> // size_t
#include <type_traits> // conditional, enable_if, false_type, integral_constant, is_constructible, is_integral, is_same, remove_cv, remove_reference, true_type
#include <utility> // index_sequence, make_index_sequence, index_sequence_for
#include <nlohmann/detail/macro_scope.hpp>
namespace
nlohmann
{
namespace
detail
{
// alias templates to reduce boilerplate
template
<
bool
B
,
typename
T
=
void
>
using
enable_if_t
=
typename
std
::
enable_if
<
B
,
T
>::
type
;
template
<
typename
T
>
using
uncvref_t
=
typename
std
::
remove_cv
<
typename
std
::
remove_reference
<
T
>::
type
>::
type
;
// implementation of C++14 index_sequence and affiliates
#ifdef JSON_HAS_CPP_14
// the following utilities are natively available in C++14
using
std
::
enable_if_t
;
using
std
::
index_sequence
;
using
std
::
make_index_sequence
;
using
std
::
index_sequence_for
;
#else
// alias templates to reduce boilerplate
template
<
bool
B
,
typename
T
=
void
>
using
enable_if_t
=
typename
std
::
enable_if
<
B
,
T
>::
type
;
// source: https://stackoverflow.com/a/32223343
template
<
std
::
size_t
...
Ints
>
struct
index_sequence
...
...
@@ -45,6 +58,8 @@ template<> struct make_index_sequence<1> : index_sequence<0> {};
template
<
typename
...
Ts
>
using
index_sequence_for
=
make_index_sequence
<
sizeof
...(
Ts
)
>
;
#endif
// dispatch utility (taken from ranges-v3)
template
<
unsigned
N
>
struct
priority_tag
:
priority_tag
<
N
-
1
>
{};
template
<
>
struct
priority_tag
<
0
>
{};
...
...
@@ -58,5 +73,6 @@ struct static_const
template
<
typename
T
>
constexpr
T
static_const
<
T
>::
value
;
}
// namespace detail
}
// namespace nlohmann
This diff is collapsed.
Click to expand it.
single_include/nlohmann/json.hpp
View file @
af8c6e7a
...
...
@@ -2736,19 +2736,33 @@ class other_error : public exception
#include <cstddef> // size_t
#include <type_traits> // conditional, enable_if, false_type, integral_constant, is_constructible, is_integral, is_same, remove_cv, remove_reference, true_type
#include <utility> // index_sequence, make_index_sequence, index_sequence_for
// #include <nlohmann/detail/macro_scope.hpp>
namespace nlohmann
{
namespace detail
{
// alias templates to reduce boilerplate
template
<
bool
B
,
typename
T
=
void
>
using
enable_if_t
=
typename
std
::
enable_if
<
B
,
T
>::
type
;
template<typename T>
using uncvref_t = typename std::remove_cv<typename std::remove_reference<T>::type>::type;
// implementation of C++14 index_sequence and affiliates
#ifdef JSON_HAS_CPP_14
// the following utilities are natively available in C++14
using std::enable_if_t;
using std::index_sequence;
using std::make_index_sequence;
using std::index_sequence_for;
#else
// alias templates to reduce boilerplate
template<bool B, typename T = void>
using enable_if_t = typename std::enable_if<B, T>::type;
// source: https://stackoverflow.com/a/32223343
template<std::size_t... Ints>
struct index_sequence
...
...
@@ -2779,6 +2793,8 @@ template<> struct make_index_sequence<1> : index_sequence<0> {};
template<typename... Ts>
using index_sequence_for = make_index_sequence<sizeof...(Ts)>;
#endif
// dispatch utility (taken from ranges-v3)
template<unsigned N> struct priority_tag : priority_tag < N - 1 > {};
template<> struct priority_tag<0> {};
...
...
@@ -2792,6 +2808,7 @@ struct static_const
template<typename T>
constexpr T static_const<T>::value;
} // namespace detail
} // namespace nlohmann
...
...
This diff is collapsed.
Click to expand it.
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