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
99b7c7c8
Commit
99b7c7c8
authored
Sep 20, 2018
by
Chris Harris
Committed by
Henry Fredrick Schreiner
Sep 25, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Patch nlohmann/json for GCC 4.8
See
https://github.com/nlohmann/json/pull/212
for details
parent
e184b6ec
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
44 additions
and
32 deletions
+44
-32
macro_scope.hpp
include/nlohmann/detail/macro_scope.hpp
+1
-1
json.hpp
include/nlohmann/json.hpp
+21
-15
json.hpp
single_include/nlohmann/json.hpp
+22
-16
No files found.
include/nlohmann/detail/macro_scope.hpp
View file @
99b7c7c8
...
...
@@ -10,7 +10,7 @@
#error "unsupported Clang version - see https://github.com/nlohmann/json#supported-compilers"
#endif
#elif defined(__GNUC__) && !(defined(__ICC) || defined(__INTEL_COMPILER))
#if (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) < 40
9
00
#if (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) < 40
8
00
#error "unsupported GCC version - see https://github.com/nlohmann/json#supported-compilers"
#endif
#endif
...
...
include/nlohmann/json.hpp
View file @
99b7c7c8
...
...
@@ -4943,6 +4943,23 @@ class basic_json
return
{
it
,
res
.
second
};
}
/// helper for insertion of an iterator (supports GCC 4.8+)
template
<
typename
...
Args
>
iterator
insert_iterator
(
const_iterator
pos
,
Args
&&
...
args
)
{
iterator
result
(
this
);
assert
(
m_value
.
array
!=
nullptr
);
auto
insert_pos
=
std
::
distance
(
m_value
.
array
->
begin
(),
pos
.
m_it
.
array_iterator
);
m_value
.
array
->
insert
(
pos
.
m_it
.
array_iterator
,
std
::
forward
<
Args
>
(
args
)...);
result
.
m_it
.
array_iterator
=
m_value
.
array
->
begin
()
+
insert_pos
;
// For GCC 4.9+ only, this could become:
// result.m_it.array_iterator = m_value.array->insert(pos.m_it.array_iterator, cnt, val);
return
result
;
}
/*!
@brief inserts element
...
...
@@ -4977,9 +4994,7 @@ class basic_json
}
// insert to array and return iterator
iterator
result
(
this
);
result
.
m_it
.
array_iterator
=
m_value
.
array
->
insert
(
pos
.
m_it
.
array_iterator
,
val
);
return
result
;
return
insert_iterator
(
pos
,
val
);
}
JSON_THROW
(
type_error
::
create
(
309
,
"cannot use insert() with "
+
std
::
string
(
type_name
())));
...
...
@@ -5030,9 +5045,7 @@ class basic_json
}
// insert to array and return iterator
iterator
result
(
this
);
result
.
m_it
.
array_iterator
=
m_value
.
array
->
insert
(
pos
.
m_it
.
array_iterator
,
cnt
,
val
);
return
result
;
return
insert_iterator
(
pos
,
cnt
,
val
);
}
JSON_THROW
(
type_error
::
create
(
309
,
"cannot use insert() with "
+
std
::
string
(
type_name
())));
...
...
@@ -5094,12 +5107,7 @@ class basic_json
}
// insert to array and return iterator
iterator
result
(
this
);
result
.
m_it
.
array_iterator
=
m_value
.
array
->
insert
(
pos
.
m_it
.
array_iterator
,
first
.
m_it
.
array_iterator
,
last
.
m_it
.
array_iterator
);
return
result
;
return
insert_iterator
(
pos
,
first
.
m_it
.
array_iterator
,
last
.
m_it
.
array_iterator
);
}
/*!
...
...
@@ -5141,9 +5149,7 @@ class basic_json
}
// insert to array and return iterator
iterator
result
(
this
);
result
.
m_it
.
array_iterator
=
m_value
.
array
->
insert
(
pos
.
m_it
.
array_iterator
,
ilist
.
begin
(),
ilist
.
end
());
return
result
;
return
insert_iterator
(
pos
,
ilist
.
begin
(),
ilist
.
end
());
}
/*!
...
...
single_include/nlohmann/json.hpp
View file @
99b7c7c8
...
...
@@ -125,7 +125,7 @@ using json = basic_json<>;
#error "unsupported Clang version - see https://github.com/nlohmann/json#supported-compilers"
#endif
#elif defined(__GNUC__) && !(defined(__ICC) || defined(__INTEL_COMPILER))
#if (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) < 40
9
00
#if (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) < 40
8
00
#error "unsupported GCC version - see https://github.com/nlohmann/json#supported-compilers"
#endif
#endif
...
...
@@ -16016,6 +16016,23 @@ class basic_json
return
{
it
,
res
.
second
};
}
/// helper for insertion of an iterator (supports GCC 4.8+)
template
<
typename
...
Args
>
iterator
insert_iterator
(
const_iterator
pos
,
Args
&&
...
args
)
{
iterator
result
(
this
);
assert
(
m_value
.
array
!=
nullptr
);
auto
insert_pos
=
std
::
distance
(
m_value
.
array
->
begin
(),
pos
.
m_it
.
array_iterator
);
m_value
.
array
->
insert
(
pos
.
m_it
.
array_iterator
,
std
::
forward
<
Args
>
(
args
)...);
result
.
m_it
.
array_iterator
=
m_value
.
array
->
begin
()
+
insert_pos
;
// For GCC 4.9+ only, this could become:
// result.m_it.array_iterator = m_value.array->insert(pos.m_it.array_iterator, cnt, val);
return
result
;
}
/*!
@brief inserts element
...
...
@@ -16050,9 +16067,7 @@ class basic_json
}
// insert to array and return iterator
iterator
result
(
this
);
result
.
m_it
.
array_iterator
=
m_value
.
array
->
insert
(
pos
.
m_it
.
array_iterator
,
val
);
return
result
;
return
insert_iterator
(
pos
,
val
);
}
JSON_THROW
(
type_error
::
create
(
309
,
"cannot use insert() with "
+
std
::
string
(
type_name
())));
...
...
@@ -16103,9 +16118,7 @@ class basic_json
}
// insert to array and return iterator
iterator
result
(
this
);
result
.
m_it
.
array_iterator
=
m_value
.
array
->
insert
(
pos
.
m_it
.
array_iterator
,
cnt
,
val
);
return
result
;
return
insert_iterator
(
pos
,
cnt
,
val
);
}
JSON_THROW
(
type_error
::
create
(
309
,
"cannot use insert() with "
+
std
::
string
(
type_name
())));
...
...
@@ -16167,12 +16180,7 @@ class basic_json
}
// insert to array and return iterator
iterator
result
(
this
);
result
.
m_it
.
array_iterator
=
m_value
.
array
->
insert
(
pos
.
m_it
.
array_iterator
,
first
.
m_it
.
array_iterator
,
last
.
m_it
.
array_iterator
);
return
result
;
return
insert_iterator
(
pos
,
first
.
m_it
.
array_iterator
,
last
.
m_it
.
array_iterator
);
}
/*!
...
...
@@ -16214,9 +16222,7 @@ class basic_json
}
// insert to array and return iterator
iterator
result
(
this
);
result
.
m_it
.
array_iterator
=
m_value
.
array
->
insert
(
pos
.
m_it
.
array_iterator
,
ilist
.
begin
(),
ilist
.
end
());
return
result
;
return
insert_iterator
(
pos
,
ilist
.
begin
(),
ilist
.
end
());
}
/*!
...
...
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