Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
畅游知识海洋
json
提交
457bfc24
J
json
项目概览
畅游知识海洋
/
json
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
J
json
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
457bfc24
编写于
12月 20, 2015
作者:
N
Niels
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
work on #144
上级
1adb9d62
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
24 addition
and
3 deletion
+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
未找到文件。
README.md
浏览文件 @
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
浏览文件 @
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
浏览文件 @
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
浏览文件 @
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"
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录