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
e26a2904
Commit
e26a2904
authored
Sep 07, 2019
by
Miguel Sacristan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix and add test's for SFINAE problem
parent
06ccd43a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
2 deletions
+13
-2
include/nlohmann/json.hpp
include/nlohmann/json.hpp
+1
-1
single_include/nlohmann/json.hpp
single_include/nlohmann/json.hpp
+1
-1
test/src/unit-regression.cpp
test/src/unit-regression.cpp
+11
-0
No files found.
include/nlohmann/json.hpp
View file @
e26a2904
...
@@ -4010,7 +4010,7 @@ class basic_json
...
@@ -4010,7 +4010,7 @@ class basic_json
@since version 3.6.0
@since version 3.6.0
*/
*/
template
<
typename
KeyT
,
typename
std
::
enable_if
<
template
<
typename
KeyT
,
typename
std
::
enable_if
<
not
std
::
is_same
<
KeyT
,
json_pointer
>
::
value
,
int
>::
type
=
0
>
not
std
::
is_same
<
typename
std
::
decay
<
KeyT
>
::
type
,
json_pointer
>::
value
,
int
>::
type
=
0
>
bool
contains
(
KeyT
&&
key
)
const
bool
contains
(
KeyT
&&
key
)
const
{
{
return
is_object
()
and
m_value
.
object
->
find
(
std
::
forward
<
KeyT
>
(
key
))
!=
m_value
.
object
->
end
();
return
is_object
()
and
m_value
.
object
->
find
(
std
::
forward
<
KeyT
>
(
key
))
!=
m_value
.
object
->
end
();
...
...
single_include/nlohmann/json.hpp
View file @
e26a2904
...
@@ -18445,7 +18445,7 @@ class basic_json
...
@@ -18445,7 +18445,7 @@ class basic_json
@since version 3.6.0
@since version 3.6.0
*/
*/
template
<
typename
KeyT
,
typename
std
::
enable_if
<
template
<
typename
KeyT
,
typename
std
::
enable_if
<
not
std
::
is_same
<
KeyT
,
json_pointer
>
::
value
,
int
>::
type
=
0
>
not
std
::
is_same
<
typename
std
::
decay
<
KeyT
>
::
type
,
json_pointer
>::
value
,
int
>::
type
=
0
>
bool
contains
(
KeyT
&&
key
)
const
bool
contains
(
KeyT
&&
key
)
const
{
{
return
is_object
()
and
m_value
.
object
->
find
(
std
::
forward
<
KeyT
>
(
key
))
!=
m_value
.
object
->
end
();
return
is_object
()
and
m_value
.
object
->
find
(
std
::
forward
<
KeyT
>
(
key
))
!=
m_value
.
object
->
end
();
...
...
test/src/unit-regression.cpp
View file @
e26a2904
...
@@ -1809,6 +1809,17 @@ TEST_CASE("regression tests")
...
@@ -1809,6 +1809,17 @@ TEST_CASE("regression tests")
json
j
=
smallest
;
json
j
=
smallest
;
CHECK
(
j
.
dump
()
==
std
::
to_string
(
smallest
));
CHECK
(
j
.
dump
()
==
std
::
to_string
(
smallest
));
}
}
SECTION
(
"issue #1727 - Contains with non-const lvalue json_pointer picks the wrong overload"
)
{
json
j
=
{{
"root"
,
{{
"settings"
,
{{
"logging"
,
true
}}}}}};
auto
jptr1
=
"/root/settings/logging"
_json_pointer
;
auto
jptr2
=
json
::
json_pointer
{
"/root/settings/logging"
};
CHECK
(
j
.
contains
(
jptr1
));
CHECK
(
j
.
contains
(
jptr2
));
}
}
}
#if not defined(JSON_NOEXCEPTION)
#if not defined(JSON_NOEXCEPTION)
...
...
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