Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
J
json
Project
Overview
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
json
Commits
23496a3a
Unverified
Commit
23496a3a
authored
Jul 13, 2020
by
Niels Lohmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
🔊
add test for type traits
parent
bffa18b4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
19 additions
and
8 deletions
+19
-8
lexer.hpp
include/nlohmann/detail/input/lexer.hpp
+1
-4
type_traits.hpp
include/nlohmann/detail/meta/type_traits.hpp
+4
-0
json.hpp
single_include/nlohmann/json.hpp
+6
-4
unit-alt-number.cpp
test/src/unit-alt-number.cpp
+8
-0
No files found.
include/nlohmann/detail/input/lexer.hpp
View file @
23496a3a
...
...
@@ -13,6 +13,7 @@
#include <nlohmann/detail/input/input_adapters.hpp>
#include <nlohmann/detail/input/position_t.hpp>
#include <nlohmann/detail/macro_scope.hpp>
#include <nlohmann/detail/meta/type_traits.hpp>
namespace
nlohmann
{
...
...
@@ -918,10 +919,6 @@ class lexer : public lexer_base<BasicJsonType>
f
=
std
::
strtold
(
str
,
endptr
);
}
template
<
typename
NumberType
>
struct
is_64_bit
:
std
::
integral_constant
<
bool
,
(
sizeof
(
NumberType
)
<=
8
)
>
{};
JSON_HEDLEY_NON_NULL
(
2
)
unsigned
long
long
strtoull
(
const
char
*
str
,
char
**
str_end
,
std
::
true_type
)
{
...
...
include/nlohmann/detail/meta/type_traits.hpp
View file @
23496a3a
...
...
@@ -327,6 +327,10 @@ template<typename BasicJsonType, typename ConstructibleArrayType>
struct
is_constructible_array_type
:
is_constructible_array_type_impl
<
BasicJsonType
,
ConstructibleArrayType
>
{};
template
<
typename
NumberType
>
struct
is_64_bit
:
std
::
integral_constant
<
bool
,
(
sizeof
(
NumberType
)
<=
8
)
>
{};
template
<
typename
RealIntegerType
,
typename
CompatibleNumberIntegerType
,
typename
=
void
>
struct
is_compatible_integer_type_impl
:
std
::
false_type
{};
...
...
single_include/nlohmann/json.hpp
View file @
23496a3a
...
...
@@ -3142,6 +3142,10 @@ template<typename BasicJsonType, typename ConstructibleArrayType>
struct
is_constructible_array_type
:
is_constructible_array_type_impl
<
BasicJsonType
,
ConstructibleArrayType
>
{};
template
<
typename
NumberType
>
struct
is_64_bit
:
std
::
integral_constant
<
bool
,
(
sizeof
(
NumberType
)
<=
8
)
>
{};
template
<
typename
RealIntegerType
,
typename
CompatibleNumberIntegerType
,
typename
=
void
>
struct
is_compatible_integer_type_impl
:
std
::
false_type
{};
...
...
@@ -8118,6 +8122,8 @@ class binary_reader
// #include <nlohmann/detail/macro_scope.hpp>
// #include <nlohmann/detail/meta/type_traits.hpp>
namespace
nlohmann
{
...
...
@@ -9023,10 +9029,6 @@ class lexer : public lexer_base<BasicJsonType>
f
=
std
::
strtold
(
str
,
endptr
);
}
template
<
typename
NumberType
>
struct
is_64_bit
:
std
::
integral_constant
<
bool
,
(
sizeof
(
NumberType
)
<=
8
)
>
{};
JSON_HEDLEY_NON_NULL
(
2
)
unsigned
long
long
strtoull
(
const
char
*
str
,
char
**
str_end
,
std
::
true_type
)
{
...
...
test/src/unit-alt-number.cpp
View file @
23496a3a
...
...
@@ -101,6 +101,14 @@ TEST_CASE("Alternative number types")
// 128-bit arithmetic does not work with sanitizers
#if defined(__SIZEOF_INT128__) && !defined(__SANITIZE_ADDRESS__)
SECTION
(
"type traits"
)
{
CHECK
(
std
::
is_integral
<
__int128_t
>::
value
);
CHECK
(
std
::
is_integral
<
__uint128_t
>::
value
);
CHECK
(
std
::
numeric_limits
<
__int128_t
>::
is_integer
);
CHECK
(
std
::
numeric_limits
<
__uint128_t
>::
is_integer
);
}
SECTION
(
"128 bit integers"
)
{
using
json128
=
nlohmann
::
basic_json
<
std
::
map
,
std
::
vector
,
std
::
string
,
bool
,
__int128_t
,
__uint128_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