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
5beea354
Commit
5beea354
authored
May 10, 2017
by
Niels Lohmann
Committed by
GitHub
May 10, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #578 from Type1J/develop_feature_first_second
Adding first and second properties to iteration_proxy_internal
parents
15ef9b8a
6a656ed3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
42 additions
and
1 deletion
+42
-1
json.hpp
src/json.hpp
+42
-1
No files found.
src/json.hpp
View file @
5beea354
...
...
@@ -7877,6 +7877,44 @@ class basic_json
class
iteration_proxy
{
private
:
/// helper class for first "property"
template
<
typename
ProxyType
>
class
iterator_key_property
{
private
:
/// the reference to the proxy
ProxyType
&
proxy
;
public
:
explicit
iterator_key_property
(
ProxyType
&
proxyRef
)
noexcept
:
proxy
(
proxyRef
)
{}
/// conversion operator (calls key())
operator
typename
basic_json
::
string_t
()
const
{
return
proxy
.
key
();
}
};
/// helper class for second "property"
template
<
typename
ProxyType
>
class
iterator_value_property
{
private
:
/// the reference to the proxy
ProxyType
&
proxy
;
public
:
explicit
iterator_value_property
(
ProxyType
&
proxyRef
)
noexcept
:
proxy
(
proxyRef
)
{}
/// conversion operator (calls value())
operator
typename
IteratorType
::
reference
()
const
{
return
proxy
.
value
();
}
};
/// helper class for iteration
class
iteration_proxy_internal
{
...
...
@@ -7887,8 +7925,11 @@ class basic_json
size_t
array_index
=
0
;
public
:
iterator_key_property
<
iteration_proxy_internal
>
first
;
iterator_value_property
<
iteration_proxy_internal
>
second
;
explicit
iteration_proxy_internal
(
IteratorType
it
)
noexcept
:
anchor
(
it
)
:
anchor
(
it
)
,
first
(
*
this
),
second
(
*
this
)
{}
/// dereference operator (needed for range-based for)
...
...
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