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
b56117b1
Commit
b56117b1
authored
Jan 16, 2017
by
Théo DELRIEU
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add noexcept tests
parent
af94e712
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
2 deletions
+7
-2
src/json.hpp
src/json.hpp
+1
-1
src/json.hpp.re2c
src/json.hpp.re2c
+1
-1
test/src/unit-noexcept.cpp
test/src/unit-noexcept.cpp
+5
-0
No files found.
src/json.hpp
View file @
b56117b1
...
...
@@ -840,7 +840,7 @@ template <typename = void, typename = void>
struct
adl_serializer
{
template
<
typename
Json
,
typename
T
>
static
void
from_json
(
Json
&&
j
,
T
&
val
)
static
void
from_json
(
Json
&&
j
,
T
&
val
)
noexcept
(
noexcept
(
::
nlohmann
::
from_json
(
std
::
forward
<
Json
>
(
j
),
val
)))
{
::
nlohmann
::
from_json
(
std
::
forward
<
Json
>
(
j
),
val
);
}
...
...
src/json.hpp.re2c
View file @
b56117b1
...
...
@@ -840,7 +840,7 @@ template <typename = void, typename = void>
struct adl_serializer
{
template <typename Json, typename T>
static void from_json(Json&& j, T& val)
static void from_json(Json&& j, T& val)
noexcept(noexcept(::nlohmann::from_json(std::forward<Json>(j), val)))
{
::nlohmann::from_json(std::forward<Json>(j), val);
}
...
...
test/src/unit-noexcept.cpp
View file @
b56117b1
...
...
@@ -13,6 +13,8 @@ struct pod_bis {};
void
to_json
(
json
&
,
pod
)
noexcept
;
void
to_json
(
json
&
,
pod_bis
);
void
from_json
(
const
json
&
,
pod
)
noexcept
;
void
from_json
(
const
json
&
,
pod_bis
);
static
json
j
;
static_assert
(
noexcept
(
json
{}),
""
);
...
...
@@ -25,3 +27,6 @@ static_assert(not noexcept(nlohmann::to_json(j, pod_bis{})), "");
static_assert
(
noexcept
(
json
(
2
)),
""
);
static_assert
(
noexcept
(
json
(
test
{})),
""
);
static_assert
(
noexcept
(
json
(
pod
{})),
""
);
static_assert
(
noexcept
(
j
.
get
<
pod
>
()),
""
);
static_assert
(
not
noexcept
(
j
.
get
<
pod_bis
>
()),
""
);
static_assert
(
noexcept
(
json
(
pod
{})),
""
);
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