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
2a5506ed
Commit
2a5506ed
authored
Mar 16, 2018
by
Guillaume Racicot
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Amalgamated headers
parent
81657079
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
0 deletions
+38
-0
single_include/nlohmann/json.hpp
single_include/nlohmann/json.hpp
+38
-0
No files found.
single_include/nlohmann/json.hpp
View file @
2a5506ed
...
...
@@ -353,6 +353,16 @@ struct is_compatible_object_type_impl<true, RealType, CompatibleObjectType>
std
::
is_constructible
<
typename
RealType
::
mapped_type
,
typename
CompatibleObjectType
::
mapped_type
>::
value
;
};
template
<
bool
B
,
class
RealType
,
class
CompatibleStringType
>
struct
is_compatible_string_type_impl
:
std
::
false_type
{};
template
<
class
RealType
,
class
CompatibleStringType
>
struct
is_compatible_string_type_impl
<
true
,
RealType
,
CompatibleStringType
>
{
static
constexpr
auto
value
=
std
::
is_same
<
typename
RealType
::
value_type
,
typename
CompatibleStringType
::
value_type
>::
value
;
};
template
<
class
BasicJsonType
,
class
CompatibleObjectType
>
struct
is_compatible_object_type
{
...
...
@@ -363,6 +373,15 @@ struct is_compatible_object_type
typename
BasicJsonType
::
object_t
,
CompatibleObjectType
>::
value
;
};
template
<
class
BasicJsonType
,
class
CompatibleStringType
>
struct
is_compatible_string_type
{
static
auto
constexpr
value
=
is_compatible_string_type_impl
<
conjunction
<
negation
<
std
::
is_same
<
void
,
CompatibleStringType
>>
,
has_value_type
<
CompatibleStringType
>>::
value
,
typename
BasicJsonType
::
string_t
,
CompatibleStringType
>::
value
;
};
template
<
typename
BasicJsonType
,
typename
T
>
struct
is_basic_json_nested_type
{
...
...
@@ -977,6 +996,25 @@ void from_json(const BasicJsonType& j, typename BasicJsonType::string_t& s)
s
=
*
j
.
template
get_ptr
<
const
typename
BasicJsonType
::
string_t
*
>();
}
template
<
typename
BasicJsonType
,
typename
CompatibleStringType
,
enable_if_t
<
is_compatible_string_type
<
BasicJsonType
,
CompatibleStringType
>
::
value
and
not
std
::
is_same
<
typename
BasicJsonType
::
string_t
,
CompatibleStringType
>::
value
and
std
::
is_constructible
<
BasicJsonType
,
typename
CompatibleStringType
::
value_type
>::
value
,
int
>
=
0
>
void
from_json
(
const
BasicJsonType
&
j
,
CompatibleStringType
&
s
)
{
if
(
JSON_UNLIKELY
(
not
j
.
is_string
()))
{
JSON_THROW
(
type_error
::
create
(
302
,
"type must be string, but is "
+
std
::
string
(
j
.
type_name
())));
}
s
=
*
j
.
template
get_ptr
<
const
typename
BasicJsonType
::
string_t
*
>();
}
template
<
typename
BasicJsonType
>
void
from_json
(
const
BasicJsonType
&
j
,
typename
BasicJsonType
::
number_float_t
&
val
)
{
...
...
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