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
7fc4b290
Unverified
Commit
7fc4b290
authored
Jul 17, 2020
by
Niels Lohmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
🚸
add static assertion for missing binary function in SAX interface
parent
a10d486e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
12 deletions
+26
-12
is_sax.hpp
include/nlohmann/detail/meta/is_sax.hpp
+13
-6
json.hpp
single_include/nlohmann/json.hpp
+13
-6
No files found.
include/nlohmann/detail/meta/is_sax.hpp
View file @
7fc4b290
...
@@ -34,6 +34,10 @@ template<typename T, typename String>
...
@@ -34,6 +34,10 @@ template<typename T, typename String>
using
string_function_t
=
using
string_function_t
=
decltype
(
std
::
declval
<
T
&>
().
string
(
std
::
declval
<
String
&>
()));
decltype
(
std
::
declval
<
T
&>
().
string
(
std
::
declval
<
String
&>
()));
template
<
typename
T
,
typename
Binary
>
using
binary_function_t
=
decltype
(
std
::
declval
<
T
&>
().
binary
(
std
::
declval
<
Binary
&>
()));
template
<
typename
T
>
template
<
typename
T
>
using
start_object_function_t
=
using
start_object_function_t
=
decltype
(
std
::
declval
<
T
&>
().
start_object
(
std
::
declval
<
std
::
size_t
>
()));
decltype
(
std
::
declval
<
T
&>
().
start_object
(
std
::
declval
<
std
::
size_t
>
()));
...
@@ -68,19 +72,18 @@ struct is_sax
...
@@ -68,19 +72,18 @@ struct is_sax
using
number_unsigned_t
=
typename
BasicJsonType
::
number_unsigned_t
;
using
number_unsigned_t
=
typename
BasicJsonType
::
number_unsigned_t
;
using
number_float_t
=
typename
BasicJsonType
::
number_float_t
;
using
number_float_t
=
typename
BasicJsonType
::
number_float_t
;
using
string_t
=
typename
BasicJsonType
::
string_t
;
using
string_t
=
typename
BasicJsonType
::
string_t
;
using
binary_t
=
typename
BasicJsonType
::
binary_t
;
using
exception_t
=
typename
BasicJsonType
::
exception
;
using
exception_t
=
typename
BasicJsonType
::
exception
;
public
:
public
:
static
constexpr
bool
value
=
static
constexpr
bool
value
=
is_detected_exact
<
bool
,
null_function_t
,
SAX
>::
value
&&
is_detected_exact
<
bool
,
null_function_t
,
SAX
>::
value
&&
is_detected_exact
<
bool
,
boolean_function_t
,
SAX
>::
value
&&
is_detected_exact
<
bool
,
boolean_function_t
,
SAX
>::
value
&&
is_detected_exact
<
bool
,
number_integer_function_t
,
SAX
,
is_detected_exact
<
bool
,
number_integer_function_t
,
SAX
,
number_integer_t
>::
value
&&
number_integer_t
>::
value
&&
is_detected_exact
<
bool
,
number_unsigned_function_t
,
SAX
,
number_unsigned_t
>::
value
&&
is_detected_exact
<
bool
,
number_unsigned_function_t
,
SAX
,
is_detected_exact
<
bool
,
number_float_function_t
,
SAX
,
number_float_t
,
string_t
>::
value
&&
number_unsigned_t
>::
value
&&
is_detected_exact
<
bool
,
number_float_function_t
,
SAX
,
number_float_t
,
string_t
>::
value
&&
is_detected_exact
<
bool
,
string_function_t
,
SAX
,
string_t
>::
value
&&
is_detected_exact
<
bool
,
string_function_t
,
SAX
,
string_t
>::
value
&&
is_detected_exact
<
bool
,
binary_function_t
,
SAX
,
binary_t
>::
value
&&
is_detected_exact
<
bool
,
start_object_function_t
,
SAX
>::
value
&&
is_detected_exact
<
bool
,
start_object_function_t
,
SAX
>::
value
&&
is_detected_exact
<
bool
,
key_function_t
,
SAX
,
string_t
>::
value
&&
is_detected_exact
<
bool
,
key_function_t
,
SAX
,
string_t
>::
value
&&
is_detected_exact
<
bool
,
end_object_function_t
,
SAX
>::
value
&&
is_detected_exact
<
bool
,
end_object_function_t
,
SAX
>::
value
&&
...
@@ -100,6 +103,7 @@ struct is_sax_static_asserts
...
@@ -100,6 +103,7 @@ struct is_sax_static_asserts
using
number_unsigned_t
=
typename
BasicJsonType
::
number_unsigned_t
;
using
number_unsigned_t
=
typename
BasicJsonType
::
number_unsigned_t
;
using
number_float_t
=
typename
BasicJsonType
::
number_float_t
;
using
number_float_t
=
typename
BasicJsonType
::
number_float_t
;
using
string_t
=
typename
BasicJsonType
::
string_t
;
using
string_t
=
typename
BasicJsonType
::
string_t
;
using
binary_t
=
typename
BasicJsonType
::
binary_t
;
using
exception_t
=
typename
BasicJsonType
::
exception
;
using
exception_t
=
typename
BasicJsonType
::
exception
;
public
:
public
:
...
@@ -123,6 +127,9 @@ struct is_sax_static_asserts
...
@@ -123,6 +127,9 @@ struct is_sax_static_asserts
static_assert
(
static_assert
(
is_detected_exact
<
bool
,
string_function_t
,
SAX
,
string_t
>::
value
,
is_detected_exact
<
bool
,
string_function_t
,
SAX
,
string_t
>::
value
,
"Missing/invalid function: bool string(string_t&)"
);
"Missing/invalid function: bool string(string_t&)"
);
static_assert
(
is_detected_exact
<
bool
,
binary_function_t
,
SAX
,
binary_t
>::
value
,
"Missing/invalid function: bool binary(binary_t&)"
);
static_assert
(
is_detected_exact
<
bool
,
start_object_function_t
,
SAX
>::
value
,
static_assert
(
is_detected_exact
<
bool
,
start_object_function_t
,
SAX
>::
value
,
"Missing/invalid function: bool start_object(std::size_t)"
);
"Missing/invalid function: bool start_object(std::size_t)"
);
static_assert
(
is_detected_exact
<
bool
,
key_function_t
,
SAX
,
string_t
>::
value
,
static_assert
(
is_detected_exact
<
bool
,
key_function_t
,
SAX
,
string_t
>::
value
,
...
...
single_include/nlohmann/json.hpp
View file @
7fc4b290
...
@@ -5774,6 +5774,10 @@ template<typename T, typename String>
...
@@ -5774,6 +5774,10 @@ template<typename T, typename String>
using
string_function_t
=
using
string_function_t
=
decltype
(
std
::
declval
<
T
&>
().
string
(
std
::
declval
<
String
&>
()));
decltype
(
std
::
declval
<
T
&>
().
string
(
std
::
declval
<
String
&>
()));
template
<
typename
T
,
typename
Binary
>
using
binary_function_t
=
decltype
(
std
::
declval
<
T
&>
().
binary
(
std
::
declval
<
Binary
&>
()));
template
<
typename
T
>
template
<
typename
T
>
using
start_object_function_t
=
using
start_object_function_t
=
decltype
(
std
::
declval
<
T
&>
().
start_object
(
std
::
declval
<
std
::
size_t
>
()));
decltype
(
std
::
declval
<
T
&>
().
start_object
(
std
::
declval
<
std
::
size_t
>
()));
...
@@ -5808,19 +5812,18 @@ struct is_sax
...
@@ -5808,19 +5812,18 @@ struct is_sax
using
number_unsigned_t
=
typename
BasicJsonType
::
number_unsigned_t
;
using
number_unsigned_t
=
typename
BasicJsonType
::
number_unsigned_t
;
using
number_float_t
=
typename
BasicJsonType
::
number_float_t
;
using
number_float_t
=
typename
BasicJsonType
::
number_float_t
;
using
string_t
=
typename
BasicJsonType
::
string_t
;
using
string_t
=
typename
BasicJsonType
::
string_t
;
using
binary_t
=
typename
BasicJsonType
::
binary_t
;
using
exception_t
=
typename
BasicJsonType
::
exception
;
using
exception_t
=
typename
BasicJsonType
::
exception
;
public
:
public
:
static
constexpr
bool
value
=
static
constexpr
bool
value
=
is_detected_exact
<
bool
,
null_function_t
,
SAX
>::
value
&&
is_detected_exact
<
bool
,
null_function_t
,
SAX
>::
value
&&
is_detected_exact
<
bool
,
boolean_function_t
,
SAX
>::
value
&&
is_detected_exact
<
bool
,
boolean_function_t
,
SAX
>::
value
&&
is_detected_exact
<
bool
,
number_integer_function_t
,
SAX
,
is_detected_exact
<
bool
,
number_integer_function_t
,
SAX
,
number_integer_t
>::
value
&&
number_integer_t
>::
value
&&
is_detected_exact
<
bool
,
number_unsigned_function_t
,
SAX
,
number_unsigned_t
>::
value
&&
is_detected_exact
<
bool
,
number_unsigned_function_t
,
SAX
,
is_detected_exact
<
bool
,
number_float_function_t
,
SAX
,
number_float_t
,
string_t
>::
value
&&
number_unsigned_t
>::
value
&&
is_detected_exact
<
bool
,
number_float_function_t
,
SAX
,
number_float_t
,
string_t
>::
value
&&
is_detected_exact
<
bool
,
string_function_t
,
SAX
,
string_t
>::
value
&&
is_detected_exact
<
bool
,
string_function_t
,
SAX
,
string_t
>::
value
&&
is_detected_exact
<
bool
,
binary_function_t
,
SAX
,
binary_t
>::
value
&&
is_detected_exact
<
bool
,
start_object_function_t
,
SAX
>::
value
&&
is_detected_exact
<
bool
,
start_object_function_t
,
SAX
>::
value
&&
is_detected_exact
<
bool
,
key_function_t
,
SAX
,
string_t
>::
value
&&
is_detected_exact
<
bool
,
key_function_t
,
SAX
,
string_t
>::
value
&&
is_detected_exact
<
bool
,
end_object_function_t
,
SAX
>::
value
&&
is_detected_exact
<
bool
,
end_object_function_t
,
SAX
>::
value
&&
...
@@ -5840,6 +5843,7 @@ struct is_sax_static_asserts
...
@@ -5840,6 +5843,7 @@ struct is_sax_static_asserts
using
number_unsigned_t
=
typename
BasicJsonType
::
number_unsigned_t
;
using
number_unsigned_t
=
typename
BasicJsonType
::
number_unsigned_t
;
using
number_float_t
=
typename
BasicJsonType
::
number_float_t
;
using
number_float_t
=
typename
BasicJsonType
::
number_float_t
;
using
string_t
=
typename
BasicJsonType
::
string_t
;
using
string_t
=
typename
BasicJsonType
::
string_t
;
using
binary_t
=
typename
BasicJsonType
::
binary_t
;
using
exception_t
=
typename
BasicJsonType
::
exception
;
using
exception_t
=
typename
BasicJsonType
::
exception
;
public
:
public
:
...
@@ -5863,6 +5867,9 @@ struct is_sax_static_asserts
...
@@ -5863,6 +5867,9 @@ struct is_sax_static_asserts
static_assert
(
static_assert
(
is_detected_exact
<
bool
,
string_function_t
,
SAX
,
string_t
>::
value
,
is_detected_exact
<
bool
,
string_function_t
,
SAX
,
string_t
>::
value
,
"Missing/invalid function: bool string(string_t&)"
);
"Missing/invalid function: bool string(string_t&)"
);
static_assert
(
is_detected_exact
<
bool
,
binary_function_t
,
SAX
,
binary_t
>::
value
,
"Missing/invalid function: bool binary(binary_t&)"
);
static_assert
(
is_detected_exact
<
bool
,
start_object_function_t
,
SAX
>::
value
,
static_assert
(
is_detected_exact
<
bool
,
start_object_function_t
,
SAX
>::
value
,
"Missing/invalid function: bool start_object(std::size_t)"
);
"Missing/invalid function: bool start_object(std::size_t)"
);
static_assert
(
is_detected_exact
<
bool
,
key_function_t
,
SAX
,
string_t
>::
value
,
static_assert
(
is_detected_exact
<
bool
,
key_function_t
,
SAX
,
string_t
>::
value
,
...
...
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