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
fb8c11f2
Commit
fb8c11f2
authored
Jun 23, 2020
by
gatopeich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Re-implement ordered_map::erase,
so that it can handle pair<const Key,...>
parent
acd748e1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
8 deletions
+22
-8
json.hpp
include/nlohmann/json.hpp
+3
-3
ordered_map.hpp
include/nlohmann/ordered_map.hpp
+8
-1
json.hpp
single_include/nlohmann/json.hpp
+11
-4
No files found.
include/nlohmann/json.hpp
View file @
fb8c11f2
...
...
@@ -499,9 +499,9 @@ class basic_json
// Note the use of std::map default allocator as a placeholder
// to extract the actual ObjectType::value_type
AllocatorType
<
typename
ObjectType
<
StringType
,
basic_json
,
object_comparator_t
,
std
::
allocator
<
std
::
pair
<
const
StringType
,
basic_json
>>
>::
value_type
>>
;
ObjectType
<
StringType
,
basic_json
,
object_comparator_t
,
std
::
allocator
<
std
::
pair
<
const
StringType
,
basic_json
>>
>::
value_type
>>
;
/*!
@brief a type for an array
...
...
include/nlohmann/ordered_map.hpp
View file @
fb8c11f2
...
...
@@ -46,7 +46,14 @@ struct ordered_map : Container
{
if
(
it
->
first
==
key
)
{
Container
::
erase
(
it
);
// Since we cannot move const Keys, re-construct them in place
for
(
auto
next
=
it
;
++
next
!=
this
->
end
();
++
it
)
{
// *it = std::move(*next); // deleted
it
->~
value_type
();
// Destroy but keep allocation
new
(
&*
it
)
value_type
{
std
::
move
(
*
next
)};
}
Container
::
pop_back
();
return
1
;
}
}
...
...
single_include/nlohmann/json.hpp
View file @
fb8c11f2
...
...
@@ -15915,7 +15915,14 @@ struct ordered_map : Container
{
if
(
it
->
first
==
key
)
{
Container
::
erase
(
it
);
// Since we cannot move const Keys, re-construct them in place
for
(
auto
next
=
it
;
++
next
!=
this
->
end
();
++
it
)
{
// *it = std::move(*next); // deleted
it
->~
value_type
();
// Destroy but keep allocation
new
(
&*
it
)
value_type
{
std
::
move
(
*
next
)};
}
Container
::
pop_back
();
return
1
;
}
}
...
...
@@ -16351,9 +16358,9 @@ class basic_json
// Note the use of std::map default allocator as a placeholder
// to extract the actual ObjectType::value_type
AllocatorType
<
typename
ObjectType
<
StringType
,
basic_json
,
object_comparator_t
,
std
::
allocator
<
std
::
pair
<
const
StringType
,
basic_json
>>
>::
value_type
>>
;
ObjectType
<
StringType
,
basic_json
,
object_comparator_t
,
std
::
allocator
<
std
::
pair
<
const
StringType
,
basic_json
>>
>::
value_type
>>
;
/*!
@brief a type for an array
...
...
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