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
dae0fe79
Unverified
Commit
dae0fe79
authored
Oct 03, 2019
by
Niels Lohmann
Committed by
GitHub
Oct 03, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1769 from chris0x44/json_pointer
Make json_pointer::back const (resolves #1764)
parents
d826282f
7476f5ee
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
2 deletions
+6
-2
json_pointer.hpp
include/nlohmann/detail/json_pointer.hpp
+1
-1
json.hpp
single_include/nlohmann/json.hpp
+1
-1
unit-json_pointer.cpp
test/src/unit-json_pointer.cpp
+4
-0
No files found.
include/nlohmann/detail/json_pointer.hpp
View file @
dae0fe79
...
@@ -267,7 +267,7 @@ class json_pointer
...
@@ -267,7 +267,7 @@ class json_pointer
@since version 3.6.0
@since version 3.6.0
*/
*/
const
std
::
string
&
back
()
const
std
::
string
&
back
()
const
{
{
if
(
JSON_HEDLEY_UNLIKELY
(
empty
()))
if
(
JSON_HEDLEY_UNLIKELY
(
empty
()))
{
{
...
...
single_include/nlohmann/json.hpp
View file @
dae0fe79
...
@@ -10232,7 +10232,7 @@ class json_pointer
...
@@ -10232,7 +10232,7 @@ class json_pointer
@since version 3.6.0
@since version 3.6.0
*/
*/
const
std
::
string
&
back
()
const
std
::
string
&
back
()
const
{
{
if
(
JSON_HEDLEY_UNLIKELY
(
empty
()))
if
(
JSON_HEDLEY_UNLIKELY
(
empty
()))
{
{
...
...
test/src/unit-json_pointer.cpp
View file @
dae0fe79
...
@@ -559,6 +559,10 @@ TEST_CASE("JSON pointers")
...
@@ -559,6 +559,10 @@ TEST_CASE("JSON pointers")
CHECK
(
!
ptr
.
empty
());
CHECK
(
!
ptr
.
empty
());
CHECK
(
j
[
ptr
]
==
j
[
"answer"
][
"everything"
]);
CHECK
(
j
[
ptr
]
==
j
[
"answer"
][
"everything"
]);
// check access via const pointer
const
auto
cptr
=
ptr
;
CHECK
(
cptr
.
back
()
==
"everything"
);
ptr
.
pop_back
();
ptr
.
pop_back
();
ptr
.
pop_back
();
ptr
.
pop_back
();
CHECK
(
ptr
.
empty
());
CHECK
(
ptr
.
empty
());
...
...
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