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
0f3ec003
Commit
0f3ec003
authored
Nov 12, 2019
by
Isaac Nickaein
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove harmful vector::reserve during destruction (#1837)
parent
be61ad14
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
0 additions
and
14 deletions
+0
-14
include/nlohmann/json.hpp
include/nlohmann/json.hpp
+0
-7
single_include/nlohmann/json.hpp
single_include/nlohmann/json.hpp
+0
-7
No files found.
include/nlohmann/json.hpp
View file @
0f3ec003
...
...
@@ -1004,13 +1004,10 @@ class basic_json
// move the top-level items to stack
if
(
t
==
value_t
::
array
)
{
stack
.
reserve
(
array
->
size
());
std
::
move
(
array
->
begin
(),
array
->
end
(),
std
::
back_inserter
(
stack
));
}
else
if
(
t
==
value_t
::
object
)
{
stack
.
reserve
(
object
->
size
());
for
(
auto
&&
it
:
*
object
)
{
stack
.
push_back
(
std
::
move
(
it
.
second
));
...
...
@@ -1027,8 +1024,6 @@ class basic_json
// its children to the stack to be processed later
if
(
current_item
.
is_array
())
{
stack
.
reserve
(
stack
.
size
()
+
current_item
.
m_value
.
array
->
size
());
std
::
move
(
current_item
.
m_value
.
array
->
begin
(),
current_item
.
m_value
.
array
->
end
(),
std
::
back_inserter
(
stack
));
...
...
@@ -1036,8 +1031,6 @@ class basic_json
}
else
if
(
current_item
.
is_object
())
{
stack
.
reserve
(
stack
.
size
()
+
current_item
.
m_value
.
object
->
size
());
for
(
auto
&&
it
:
*
current_item
.
m_value
.
object
)
{
stack
.
push_back
(
std
::
move
(
it
.
second
));
...
...
single_include/nlohmann/json.hpp
View file @
0f3ec003
...
...
@@ -15547,13 +15547,10 @@ class basic_json
// move the top-level items to stack
if
(
t
==
value_t
::
array
)
{
stack
.
reserve
(
array
->
size
());
std
::
move
(
array
->
begin
(),
array
->
end
(),
std
::
back_inserter
(
stack
));
}
else
if
(
t
==
value_t
::
object
)
{
stack
.
reserve
(
object
->
size
());
for
(
auto
&&
it
:
*
object
)
{
stack
.
push_back
(
std
::
move
(
it
.
second
));
...
...
@@ -15570,8 +15567,6 @@ class basic_json
// its children to the stack to be processed later
if
(
current_item
.
is_array
())
{
stack
.
reserve
(
stack
.
size
()
+
current_item
.
m_value
.
array
->
size
());
std
::
move
(
current_item
.
m_value
.
array
->
begin
(),
current_item
.
m_value
.
array
->
end
(),
std
::
back_inserter
(
stack
));
...
...
@@ -15579,8 +15574,6 @@ class basic_json
}
else
if
(
current_item
.
is_object
())
{
stack
.
reserve
(
stack
.
size
()
+
current_item
.
m_value
.
object
->
size
());
for
(
auto
&&
it
:
*
current_item
.
m_value
.
object
)
{
stack
.
push_back
(
std
::
move
(
it
.
second
));
...
...
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