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
457bfc24
Commit
457bfc24
authored
Dec 20, 2015
by
Niels
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
work on #144
parent
1adb9d62
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
24 additions
and
3 deletions
+24
-3
README.md
README.md
+1
-1
src/json.hpp
src/json.hpp
+5
-1
src/json.hpp.re2c
src/json.hpp.re2c
+5
-1
test/unit.cpp
test/unit.cpp
+13
-0
No files found.
README.md
View file @
457bfc24
...
...
@@ -398,7 +398,7 @@ $ make
$
./json_unit
"*"
===============================================================================
All tests passed
(
334184
6
assertions
in
28
test
cases
)
All tests passed
(
334184
8
assertions
in
28
test
cases
)
```
For more information, have a look at the file
[
.travis.yml
](
https://github.com/nlohmann/json/blob/master/.travis.yml
)
.
src/json.hpp
View file @
457bfc24
...
...
@@ -2550,7 +2550,9 @@ class basic_json
@tparam ValueType non-pointer type compatible to the JSON value, for
instance `int` for JSON integer numbers, `bool` for JSON booleans, or
`std::vector` types for JSON arrays
`std::vector` types for JSON arrays. The character type of @ref string_t
as well as an initializer list of this type is excluded to avoid
ambiguities as these types implicitly convert to `std::string`.
@return copy of the JSON value, converted to type @a ValueType
...
...
@@ -2571,6 +2573,8 @@ class basic_json
template
<
typename
ValueType
,
typename
std
::
enable_if
<
not
std
::
is_pointer
<
ValueType
>
::
value
and
not
std
::
is_same
<
ValueType
,
typename
string_t
::
value_type
>::
value
and
not
std
::
is_same
<
ValueType
,
std
::
initializer_list
<
typename
string_t
::
value_type
>>::
value
,
int
>::
type
=
0
>
operator
ValueType
()
const
{
...
...
src/json.hpp.re2c
View file @
457bfc24
...
...
@@ -2550,7 +2550,9 @@ class basic_json
@tparam ValueType non-pointer type compatible to the JSON value, for
instance `int` for JSON integer numbers, `bool` for JSON booleans, or
`std::vector` types for JSON arrays
`std::vector` types for JSON arrays. The character type of @ref string_t
as well as an initializer list of this type is excluded to avoid
ambiguities as these types implicitly convert to `std::string`.
@return copy of the JSON value, converted to type @a ValueType
...
...
@@ -2571,6 +2573,8 @@ class basic_json
template<typename ValueType, typename
std::enable_if<
not std::is_pointer<ValueType>::value
and not std::is_same<ValueType, typename string_t::value_type>::value
and not std::is_same<ValueType, std::initializer_list<typename string_t::value_type>>::value
, int>::type = 0>
operator ValueType() const
{
...
...
test/unit.cpp
View file @
457bfc24
...
...
@@ -10323,6 +10323,19 @@ TEST_CASE("regression tests")
CHECK
(
j
[
"string"
]
==
"\u0007\u0007"
);
}
SECTION
(
"issue #144 - implicit assignment to std::string fails"
)
{
json
o
=
{{
"name"
,
"value"
}};
std
::
string
s1
=
o
[
"name"
];
CHECK
(
s1
==
"value"
);
std
::
string
s2
;
s2
=
o
[
"name"
];
CHECK
(
s2
==
"value"
);
}
SECTION
(
"character following a surrogate pair is skipped"
)
{
CHECK
(
json
::
parse
(
"
\"\\
ud80c
\\
udc60abc
\"
"
).
get
<
json
::
string_t
>
()
==
u8"\U00013060abc"
);
...
...
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