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
77967e65
Unverified
Commit
77967e65
authored
Sep 05, 2018
by
Théo DELRIEU
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor is_compatible_integer_type
parent
13760857
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
24 deletions
+26
-24
include/nlohmann/detail/meta/type_traits.hpp
include/nlohmann/detail/meta/type_traits.hpp
+13
-12
single_include/nlohmann/json.hpp
single_include/nlohmann/json.hpp
+13
-12
No files found.
include/nlohmann/detail/meta/type_traits.hpp
View file @
77967e65
...
@@ -137,31 +137,32 @@ template <typename BasicJsonType, typename CompatibleArrayType>
...
@@ -137,31 +137,32 @@ template <typename BasicJsonType, typename CompatibleArrayType>
struct
is_compatible_array_type
struct
is_compatible_array_type
:
is_compatible_array_type_impl
<
BasicJsonType
,
CompatibleArrayType
>
{};
:
is_compatible_array_type_impl
<
BasicJsonType
,
CompatibleArrayType
>
{};
template
<
bool
,
typename
,
typename
>
template
<
typename
RealIntegerType
,
typename
CompatibleNumberIntegerType
,
typename
=
void
>
struct
is_compatible_integer_type_impl
:
std
::
false_type
{};
struct
is_compatible_integer_type_impl
:
std
::
false_type
{};
template
<
typename
RealIntegerType
,
typename
CompatibleNumberIntegerType
>
template
<
typename
RealIntegerType
,
typename
CompatibleNumberIntegerType
>
struct
is_compatible_integer_type_impl
<
true
,
RealIntegerType
,
CompatibleNumberIntegerType
>
struct
is_compatible_integer_type_impl
<
RealIntegerType
,
CompatibleNumberIntegerType
,
enable_if_t
<
std
::
is_integral
<
RealIntegerType
>::
value
and
std
::
is_integral
<
CompatibleNumberIntegerType
>::
value
and
not
std
::
is_same
<
bool
,
CompatibleNumberIntegerType
>::
value
>>
{
{
// is there an assert somewhere on overflows?
// is there an assert somewhere on overflows?
using
RealLimits
=
std
::
numeric_limits
<
RealIntegerType
>
;
using
RealLimits
=
std
::
numeric_limits
<
RealIntegerType
>
;
using
CompatibleLimits
=
std
::
numeric_limits
<
CompatibleNumberIntegerType
>
;
using
CompatibleLimits
=
std
::
numeric_limits
<
CompatibleNumberIntegerType
>
;
static
constexpr
auto
value
=
static
constexpr
auto
value
=
std
::
is_constructible
<
RealIntegerType
,
CompatibleNumberIntegerType
>::
value
and
std
::
is_constructible
<
RealIntegerType
,
CompatibleNumberIntegerType
>::
value
and
CompatibleLimits
::
is_integer
and
CompatibleLimits
::
is_integer
and
RealLimits
::
is_signed
==
CompatibleLimits
::
is_signed
;
RealLimits
::
is_signed
==
CompatibleLimits
::
is_signed
;
};
};
template
<
typename
RealIntegerType
,
typename
CompatibleNumberIntegerType
>
template
<
typename
RealIntegerType
,
typename
CompatibleNumberIntegerType
>
struct
is_compatible_integer_type
struct
is_compatible_integer_type
{
:
is_compatible_integer_type_impl
<
RealIntegerType
,
static
constexpr
auto
value
=
CompatibleNumberIntegerType
>
{};
is_compatible_integer_type_impl
<
std
::
is_integral
<
CompatibleNumberIntegerType
>::
value
and
not
std
::
is_same
<
bool
,
CompatibleNumberIntegerType
>::
value
,
RealIntegerType
,
CompatibleNumberIntegerType
>
::
value
;
};
// trait checking if JSONSerializer<T>::from_json(json const&, udt&) exists
// trait checking if JSONSerializer<T>::from_json(json const&, udt&) exists
template
<
typename
BasicJsonType
,
typename
T
>
template
<
typename
BasicJsonType
,
typename
T
>
...
...
single_include/nlohmann/json.hpp
View file @
77967e65
...
@@ -517,31 +517,32 @@ template <typename BasicJsonType, typename CompatibleArrayType>
...
@@ -517,31 +517,32 @@ template <typename BasicJsonType, typename CompatibleArrayType>
struct
is_compatible_array_type
struct
is_compatible_array_type
:
is_compatible_array_type_impl
<
BasicJsonType
,
CompatibleArrayType
>
{};
:
is_compatible_array_type_impl
<
BasicJsonType
,
CompatibleArrayType
>
{};
template
<
bool
,
typename
,
typename
>
template
<
typename
RealIntegerType
,
typename
CompatibleNumberIntegerType
,
typename
=
void
>
struct
is_compatible_integer_type_impl
:
std
::
false_type
{};
struct
is_compatible_integer_type_impl
:
std
::
false_type
{};
template
<
typename
RealIntegerType
,
typename
CompatibleNumberIntegerType
>
template
<
typename
RealIntegerType
,
typename
CompatibleNumberIntegerType
>
struct
is_compatible_integer_type_impl
<
true
,
RealIntegerType
,
CompatibleNumberIntegerType
>
struct
is_compatible_integer_type_impl
<
RealIntegerType
,
CompatibleNumberIntegerType
,
enable_if_t
<
std
::
is_integral
<
RealIntegerType
>::
value
and
std
::
is_integral
<
CompatibleNumberIntegerType
>::
value
and
not
std
::
is_same
<
bool
,
CompatibleNumberIntegerType
>::
value
>>
{
{
// is there an assert somewhere on overflows?
// is there an assert somewhere on overflows?
using
RealLimits
=
std
::
numeric_limits
<
RealIntegerType
>
;
using
RealLimits
=
std
::
numeric_limits
<
RealIntegerType
>
;
using
CompatibleLimits
=
std
::
numeric_limits
<
CompatibleNumberIntegerType
>
;
using
CompatibleLimits
=
std
::
numeric_limits
<
CompatibleNumberIntegerType
>
;
static
constexpr
auto
value
=
static
constexpr
auto
value
=
std
::
is_constructible
<
RealIntegerType
,
CompatibleNumberIntegerType
>::
value
and
std
::
is_constructible
<
RealIntegerType
,
CompatibleNumberIntegerType
>::
value
and
CompatibleLimits
::
is_integer
and
CompatibleLimits
::
is_integer
and
RealLimits
::
is_signed
==
CompatibleLimits
::
is_signed
;
RealLimits
::
is_signed
==
CompatibleLimits
::
is_signed
;
};
};
template
<
typename
RealIntegerType
,
typename
CompatibleNumberIntegerType
>
template
<
typename
RealIntegerType
,
typename
CompatibleNumberIntegerType
>
struct
is_compatible_integer_type
struct
is_compatible_integer_type
{
:
is_compatible_integer_type_impl
<
RealIntegerType
,
static
constexpr
auto
value
=
CompatibleNumberIntegerType
>
{};
is_compatible_integer_type_impl
<
std
::
is_integral
<
CompatibleNumberIntegerType
>::
value
and
not
std
::
is_same
<
bool
,
CompatibleNumberIntegerType
>::
value
,
RealIntegerType
,
CompatibleNumberIntegerType
>
::
value
;
};
// trait checking if JSONSerializer<T>::from_json(json const&, udt&) exists
// trait checking if JSONSerializer<T>::from_json(json const&, udt&) exists
template
<
typename
BasicJsonType
,
typename
T
>
template
<
typename
BasicJsonType
,
typename
T
>
...
...
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