Skip to content

Commit e3c1cd5

Browse files
Applies PR nlohmann/json#212 to support gcc 4.8.
1 parent beaea5c commit e3c1cd5

File tree

2 files changed

+16
-7
lines changed

2 files changed

+16
-7
lines changed

extern/json/README.ozz

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ Local Modifications:
88
- Extracted include and source files from json package.
99
- Striped from unsued files.
1010
- Creates a specific CMakeLists.txt
11+
- Applies PR https://github.com/nlohmann/json/pull/212 to support gcc 4.8.

extern/json/src/json.hpp

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ SOFTWARE.
6363
#error "unsupported Clang version - see https://github.com/nlohmann/json#supported-compilers"
6464
#endif
6565
#elif defined(__GNUC__)
66-
#if (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) < 40900
66+
#if (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) < 40800
6767
#error "unsupported GCC version - see https://github.com/nlohmann/json#supported-compilers"
6868
#endif
6969
#endif
@@ -5603,7 +5603,10 @@ class basic_json
56035603

56045604
// insert to array and return iterator
56055605
iterator result(this);
5606-
result.m_it.array_iterator = m_value.array->insert(pos.m_it.array_iterator, cnt, val);
5606+
auto insert_pos = std::distance(m_value.array->begin(), pos.m_it.array_iterator);
5607+
m_value.array->insert(pos.m_it.array_iterator, cnt, val);
5608+
result.m_it.array_iterator = m_value.array->begin() + insert_pos;
5609+
56075610
return result;
56085611
}
56095612

@@ -5667,10 +5670,12 @@ class basic_json
56675670

56685671
// insert to array and return iterator
56695672
iterator result(this);
5670-
result.m_it.array_iterator = m_value.array->insert(
5671-
pos.m_it.array_iterator,
5672-
first.m_it.array_iterator,
5673-
last.m_it.array_iterator);
5673+
auto insert_pos = std::distance(m_value.array->begin(), pos.m_it.array_iterator);
5674+
m_value.array->insert(pos.m_it.array_iterator,
5675+
first.m_it.array_iterator,
5676+
last.m_it.array_iterator);
5677+
result.m_it.array_iterator = m_value.array->begin() + insert_pos;
5678+
56745679
return result;
56755680
}
56765681

@@ -5714,7 +5719,10 @@ class basic_json
57145719

57155720
// insert to array and return iterator
57165721
iterator result(this);
5717-
result.m_it.array_iterator = m_value.array->insert(pos.m_it.array_iterator, ilist);
5722+
auto insert_pos = std::distance(m_value.array->begin(), pos.m_it.array_iterator);
5723+
m_value.array->insert(pos.m_it.array_iterator, ilist);
5724+
result.m_it.array_iterator = m_value.array->begin() + insert_pos;
5725+
57185726
return result;
57195727
}
57205728

0 commit comments

Comments
 (0)