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
1107f8cd
Unverified
Commit
1107f8cd
authored
Dec 21, 2018
by
Niels Lohmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
📝
updated documentation for items() function
parent
98f4e31c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
6 deletions
+28
-6
include/nlohmann/json.hpp
include/nlohmann/json.hpp
+14
-3
single_include/nlohmann/json.hpp
single_include/nlohmann/json.hpp
+14
-3
No files found.
include/nlohmann/json.hpp
View file @
1107f8cd
...
...
@@ -4340,9 +4340,20 @@ class basic_json
Range-based for loop with `items()` function:
@code{cpp}
for (auto
it
: j_object.items())
for (auto
& el
: j_object.items())
{
std::cout << "key: " << it.key() << ", value:" << it.value() << '\n';
std::cout << "key: " << el.key() << ", value:" << el.value() << '\n';
}
@endcode
The `items()` function also allows to use
[structured bindings](https://en.cppreference.com/w/cpp/language/structured_binding)
(C++17):
@code{cpp}
for (auto& [key, val] : j_object.items())
{
std::cout << "key: " << key << ", value:" << val << '\n';
}
@endcode
...
...
@@ -4360,7 +4371,7 @@ class basic_json
@complexity Constant.
@since version 3.1.0.
@since version 3.1.0
, structured bindings support since 3.5.0
.
*/
iteration_proxy
<
iterator
>
items
()
noexcept
{
...
...
single_include/nlohmann/json.hpp
View file @
1107f8cd
...
...
@@ -16720,9 +16720,20 @@ class basic_json
Range-based for loop with `items()` function:
@code{cpp}
for (auto
it
: j_object.items())
for (auto
& el
: j_object.items())
{
std::cout << "key: " << it.key() << ", value:" << it.value() << '\n';
std::cout << "key: " << el.key() << ", value:" << el.value() << '\n';
}
@endcode
The `items()` function also allows to use
[structured bindings](https://en.cppreference.com/w/cpp/language/structured_binding)
(C++17):
@code{cpp}
for (auto& [key, val] : j_object.items())
{
std::cout << "key: " << key << ", value:" << val << '\n';
}
@endcode
...
...
@@ -16740,7 +16751,7 @@ class basic_json
@complexity Constant.
@since version 3.1.0.
@since version 3.1.0
, structured bindings support since 3.5.0
.
*/
iteration_proxy
<
iterator
>
items
()
noexcept
{
...
...
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