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
62dada05
Unverified
Commit
62dada05
authored
Nov 05, 2019
by
Niels Lohmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
🐛
fix conversion to std::valarray
closes #1824
parent
7bcaba0c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
3 deletions
+3
-3
from_json.hpp
include/nlohmann/detail/conversions/from_json.hpp
+1
-1
json.hpp
single_include/nlohmann/json.hpp
+2
-2
No files found.
include/nlohmann/detail/conversions/from_json.hpp
View file @
62dada05
...
@@ -154,7 +154,7 @@ void from_json(const BasicJsonType& j, std::valarray<T>& l)
...
@@ -154,7 +154,7 @@ void from_json(const BasicJsonType& j, std::valarray<T>& l)
JSON_THROW
(
type_error
::
create
(
302
,
"type must be array, but is "
+
std
::
string
(
j
.
type_name
())));
JSON_THROW
(
type_error
::
create
(
302
,
"type must be array, but is "
+
std
::
string
(
j
.
type_name
())));
}
}
l
.
resize
(
j
.
size
());
l
.
resize
(
j
.
size
());
std
::
copy
(
j
.
m_value
.
array
->
begin
(),
j
.
m_value
.
array
->
end
(),
std
::
begin
(
l
));
std
::
copy
(
j
.
begin
(),
j
.
end
(),
std
::
begin
(
l
));
}
}
template
<
typename
BasicJsonType
,
typename
T
,
std
::
size_t
N
>
template
<
typename
BasicJsonType
,
typename
T
,
std
::
size_t
N
>
...
...
single_include/nlohmann/json.hpp
View file @
62dada05
...
@@ -3025,7 +3025,7 @@ void from_json(const BasicJsonType& j, std::valarray<T>& l)
...
@@ -3025,7 +3025,7 @@ void from_json(const BasicJsonType& j, std::valarray<T>& l)
JSON_THROW
(
type_error
::
create
(
302
,
"type must be array, but is "
+
std
::
string
(
j
.
type_name
())));
JSON_THROW
(
type_error
::
create
(
302
,
"type must be array, but is "
+
std
::
string
(
j
.
type_name
())));
}
}
l
.
resize
(
j
.
size
());
l
.
resize
(
j
.
size
());
std
::
copy
(
j
.
m_value
.
array
->
begin
(),
j
.
m_value
.
array
->
end
(),
std
::
begin
(
l
));
std
::
copy
(
j
.
begin
(),
j
.
end
(),
std
::
begin
(
l
));
}
}
template
<
typename
BasicJsonType
,
typename
T
,
std
::
size_t
N
>
template
<
typename
BasicJsonType
,
typename
T
,
std
::
size_t
N
>
...
@@ -22605,7 +22605,7 @@ struct hash<nlohmann::json>
...
@@ -22605,7 +22605,7 @@ struct hash<nlohmann::json>
/// @note: do not remove the space after '<',
/// @note: do not remove the space after '<',
/// see https://github.com/nlohmann/json/pull/679
/// see https://github.com/nlohmann/json/pull/679
template
<>
template
<>
struct
less
<
::
nlohmann
::
detail
::
value_t
>
struct
less
<::
nlohmann
::
detail
::
value_t
>
{
{
/*!
/*!
@brief compare two value_t enum values
@brief compare two value_t enum values
...
...
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